finds an independent edge set of the graph g with a maximum number of edges.
FindIndependentEdgeSet[{vw,…}]
uses rules vw to specify the graph g.
FindIndependentEdgeSet
finds an independent edge set of the graph g with a maximum number of edges.
FindIndependentEdgeSet[{vw,…}]
uses rules vw to specify the graph g.
Details and Options
- An independent edge set is also known as a matching.
- An independent edge set is a set of edges that are never incident to the same vertex.
- FindIndependentEdgeSet returns a list of edges.
- FindIndependentEdgeSet works with undirected graphs, directed graphs, weighted graphs, and multigraphs.
Examples
open all close allBasic Examples (1)
Scope (6)
FindIndependentEdgeSet works with undirected graphs:
FindIndependentEdgeSet[[image]]FindIndependentEdgeSet[[image]]FindIndependentEdgeSet[[image]]FindIndependentEdgeSet[[image]]Use rules to specify the graph:
FindIndependentEdgeSet[{1 -> 3, 2 -> 1, 3 -> 6, 4 -> 6, 1 -> 5, 5 -> 4, 6 -> 1}]FindIndependentEdgeSet works with large graphs:
g = GridGraph[{10, 10, 10, 10}];FindIndependentEdgeSet[g]//Length//TimingApplications (3)
A company has a number of different jobs. Each employee is suited for some of these jobs, and each person can perform at most one job at a time:
edges = Table[Subscript[P, i]Subscript[J, j], {i, 1, 6}, {j, Union[RandomInteger[{1, 5}, 2]]}]//Flattencoords = Join[Table[Subscript[P, i] -> {0, i - 3}, {i, 6}], Table[Subscript[J, j] -> {3, j - 2.5}, {j, 5}]];Graph[edges, VertexShapeFunction -> "Name", VertexCoordinates -> coords]Maximize the number of jobs that can be performed simultaneously:
FindIndependentEdgeSet[%]Given a set of women, each of whom has a preference for some subset of men, find a maximal matching where only matches that agree with preferences are allowed:
edges = Table[Subscript[W, i]Subscript[M, j], {i, 1, 4}, {j, Union[RandomInteger[{1, 4}, 2]]}]//Flattencoords = Join[Table[Subscript[W, i] -> {0, i - 1}, {i, 4}], Table[Subscript[M, j] -> {2, j - 1}, {j, 4}]];Graph[edges, VertexShapeFunction -> "Name", VertexCoordinates -> coords]FindIndependentEdgeSet[%]An art history department would like to offer six courses. There are eight professors, each of whom is willing to teach certain courses. Find a maximal matching where professors only teach courses they are interested in teaching:
edges = Table[Subscript[C, i]Subscript[P, j], {i, 1, 7}, {j, Union[RandomInteger[{1, 8}, 3]]}]//Flatten;coor = Join[Table[Subscript[C, i] -> {0, i - 0.5}, {i, 7}], Table[Subscript[P, j] -> {4, j - 1}, {j, 8}]];Graph[edges, VertexShapeFunction -> "Name", VertexCoordinates -> coor]FindIndependentEdgeSet[%]Properties & Relations (3)
Test whether a set of edges is an independent edge set using IndependentEdgeSetQ:
PetersenGraph[5, 2]IndependentEdgeSetQ[%, FindIndependentEdgeSet[%]]Bipartite graphs have independent edge sets and vertex covers of equal length:
g = CompleteGraph[{2, 3}]Length[FindVertexCover[g]] == Length[FindIndependentEdgeSet[g]]For a graph without isolated vertices, the sum of the size of the independent edge set and the size of the edge cover is equal to the number of vertices:
g = PetersenGraph[5, 2]Length[FindEdgeCover[g]] + Length[FindIndependentEdgeSet[g]] == VertexCount[g]Related Guides
Text
Wolfram Research (2010), FindIndependentEdgeSet, Wolfram Language function, https://reference.wolfram.com/language/ref/FindIndependentEdgeSet.html (updated 2015).
CMS
Wolfram Language. 2010. "FindIndependentEdgeSet." Wolfram Language & System Documentation Center. Wolfram Research. Last Modified 2015. https://reference.wolfram.com/language/ref/FindIndependentEdgeSet.html.
APA
Wolfram Language. (2010). FindIndependentEdgeSet. Wolfram Language & System Documentation Center. Retrieved from https://reference.wolfram.com/language/ref/FindIndependentEdgeSet.html
BibTeX
@misc{reference.wolfram_2026_findindependentedgeset, author="Wolfram Research", title="{FindIndependentEdgeSet}", year="2015", howpublished="\url{https://reference.wolfram.com/language/ref/FindIndependentEdgeSet.html}", note=[Accessed: 13-June-2026]}
BibLaTeX
@online{reference.wolfram_2026_findindependentedgeset, organization={Wolfram Research}, title={FindIndependentEdgeSet}, year={2015}, url={https://reference.wolfram.com/language/ref/FindIndependentEdgeSet.html}, note=[Accessed: 13-June-2026]}