-
Notifications
You must be signed in to change notification settings - Fork 4
Operations
Ed Scheinerman edited this page Aug 12, 2021
·
7 revisions
In addition to add!, add_edges!, and delete! the following functions modify the graph on which they operate.
-
contract!(G,v,w): contract the edge(v,w)(mergingwintov). -
complement!(G): overwriteGwith its complement.
The remainder of the functions on this page do not modify their arguments; they produce a new graph.
-
G'orcomplement(G): return the complement ofG. -
line_graph(G): line graph ofG. -
induce(G,A): return the induced subgraph ofGon vertices in the setA. -
trim(A,d=0): iteratively remove vertices of degree at mostd. -
relabel(G): new graph isomorphic toGwith vertices named1,2,...,n. -
relabel(G,d): new graph isomorphic toGwith vertices relabeled by the dictionaryd. -
subdivide(G): new graph formed by replacing every edge ofGwith a path of length two.
-
disjoint_union(G,H): disjoint union of graphsGandH. This can also be written asG+H. Note that2*G(or2G) is the same asG+G. More generally,k*G(wherekis an integer) gives a graph that is isomorphic toG+G+G+...+G(withkterms). -
union(G,H): new graph whose vertex [resp. edge] set is the union of the vertex [resp. edge] sets of the two graphs. -
cartesian(G,H): Cartesian product. -
lex(G,H)orG[H]: lexicographic product. -
join(G,H): join ofGandH. May also be invoked withG ∨ H.