Graphs

Graph(edges)
Graph(vertices, edges)

construct a graph

See also

->(), <->()

vertex1 -> vertex2
vertex1 <-> vertex2

construct an edge

Vertices(g)

return list of graph vertices

See also

Edges(), Graph()

Edges(g)

return list of graph edges

See also

Vertices(), Graph()

AdjacencyList(g)

adjacency list

Param g

graph

Return adjacency list of graph g.

AdjacencyMatrix(g)

adjacency matrix

Param g

graph

Return adjacency matrix of graph g.

BFS(g, f)
BFS(g, v, f)

traverse graph in breadth-first order

Traverse graph g in breadth-first order, starting from v if provided, or from the first vertex. f is called for every visited vertex.

See also

DFS(), Graph()

DFS(g, f)
DFS(g, v, f)

traverse graph in depth-first order

Traverse graph g in depth-first order, starting from v if provided, or from the first vertex. f is called for every visited vertex.

See also

BFS(), Graph()