Graph Examples

Functions that build a variety of different kinds of graphs.

Cyclic Graphs

A cyclic graph with n vertices is a circle with n points on it.

  • cycle_edges(length: int) creates the edge dictionary for a cycle of length n

  • cycle(length: int) creats a Graph object that represents a cyclic graph

Star Graph

A star graph with n tips is a graph with n+1 vertices and n edges joining n “tip” to a single central vertex.

  • star_edges(tips: int): the edge dictionary
  • star(tips: int): a Graph object

Bipartite Graph

An (m,n)-bipartite graph has a group of vertices with m elements and a group of vertices with n elements. There are no edges inside a group, but every vertex in a group is connected to all of the vertices in the other group.

  • bipartite_edges(m: int, n: int)
  • bipartite_graph(m: int, n: int)