next | previous | forward | backward | up | top | index | toc | Macaulay2 website
EdgeIdeals :: Graph

Graph -- a class for graphs


This class represents simple graphs. This class extends HyperGraph and hence inherits all HyperGraph methods.

i1 : R = QQ[w,x,y,z];
i2 : G = graph(R, {{w,x},{w,y},{w,z},{y,z}});
i3 : vertices G

o3 = {w, x, y, z}

o3 : List
i4 : edges G

o4 = {{w, x}, {w, y}, {w, z}, {y, z}}

o4 : List
i5 : ring G

o5 = R

o5 : PolynomialRing

Like hypergraphs, graphs are associated with a polynomial ring whose variables are the vertices of the graph. Isolated vertices should not appear in the edge list. As a consequence, the edgeIdeal of a graph is always generated by quadratics. The fact that isolated vertices are not edges in a graph affects the output of the methods connectedComponents, numConnectedComponents, and isConnected. One can use connectedGraphComponents, numConnectedGraphComponents, and isConnectedGraph to ensure that each isolated vertex is counted as a separate connected component.

See also

Functions and methods returning a graph :

Methods that use a graph :

For the programmer

The object Graph is a type, with ancestor classes HyperGraph < HashTable < Thing.