Quantcast

Documentation Center

  • Trial Software
  • Product Updates

Graph::plotBipartiteGraph

Plots a Graph in a bipartite layout

Use only in the MuPAD Notebook Interface.

This functionality does not run in MATLAB.

Syntax

Graph::plotBipartiteGraph(G, <PointSize = n>, <SpecialVertices = [v1, …,vn]>, <SpecialEdges = [e1, …,en]>, <EdgeColor = RGB>, <SpecialEdgeColor = RGB>, <SpecialVertexColor = RGB>, <Vertex1Color = RGB>, <Vertex2Color = RGB>)

Description

Graph::plotBipartiteGraph(G) returns a plot::Group2d object in which the vertices are ordered in two rows (from bottom to top). The first vertex in the left row is drawn in blue and the second (the first vertex in the right row) in green. All other vertices are drawn in red. The width of the points is predefined with 40.

Examples

Example 1

A random graph is created and plotted (your output may differ due to random creation):

G1 := Graph::createRandomGraph(110, 10, Undirected):
plot(Graph::plotBipartiteGraph(G1)):

Example 2

If some edges are to be emphasized they can be drawn in a special color:

G2 := Graph([1, 2, 3, 4, 5, 6],
            [[1, 2], [2, 3], [3, 4], [4, 5], [1, 6]]):
Graph::bipartite(G2, Lists)

edges := [[6, 1], [1, 2]]:
plot(Graph::plotBipartiteGraph(G2, SpecialEdges = edges,
                               SpecialEdgeColor = RGB::Blue))

Parameters

G

Graph

n

a positive integer.

[v1, …,vn]

a list of vertices.

[e1, …,en]

a list of edges.

Options

PointSize

Defines the thickness in which the points are drawn. Default is 40.

SpecialVertices

Defines a set of vertices. This option makes only sense if used with the option SpecialVertexColor.

SpecialEdges

Defines a set of edges. This option makes only sense if used with the option SpecialEdgeColor.

EdgeColor

Defines a color with which to draw the edges. Default is RGB ::Red.

SpecialEdgeColor

Defines a color to be used to draw the set of edges specified. This option makes only sense if used with the option SpecialEdges.

VertexColor

Defines a color with which to draw the vertices. If this option is specified, the first two vertices are set to this color, too. They can be given different colors via Vertex1Color and Vertex2Color. Default is RGB::Red.

SpecialVertexColor

Defines a color to be used to draw the set of vertices specified. This option makes only sense if used with the option SpecialVertices.

Vertex1Color

Defines a color with which to draw the first vertex with (the starting vertex at the bottom of the first set). Default is RGB::Blue.

Vertex2Color

Defines a color with which to draw the second vertex with (the starting vertex at the bottom of the second set). Default is RGB::Green.

Return Values

plot::Group2d

Was this topic helpful?