public class DefaultGraphType extends Object implements GraphType, Serializable
The graph type describes various properties of a graph such as whether it is directed, undirected or mixed, whether it contain self-loops (a self-loop is an edge where the source vertex is the same as the target vertex), whether it contain multiple (parallel) edges (multiple edges which connect the same pair of vertices) and whether it is weighted or not.
The type of a graph can be queried on runtime using method Graph.getType(). This way, for
example, an algorithm can have different behavior based on whether the input graph is directed or
undirected, etc.
| Modifier and Type | Class and Description |
|---|---|
static class |
DefaultGraphType.Builder
A builder for
DefaultGraphType. |
| Modifier and Type | Method and Description |
|---|---|
GraphType |
asDirected()
Create a directed variant of the current graph type.
|
GraphType |
asMixed()
Create a mixed variant of the current graph type.
|
GraphType |
asModifiable()
Create a modifiable variant of the current graph type.
|
GraphType |
asUndirected()
Create an undirected variant of the current graph type.
|
GraphType |
asUnmodifiable()
Create an unmodifiable variant of the current graph type.
|
GraphType |
asUnweighted()
Create an unweighted variant of the current graph type.
|
GraphType |
asWeighted()
Create a weighted variant of the current graph type.
|
static DefaultGraphType |
dag()
A directed acyclic graph.
|
static DefaultGraphType |
directedMultigraph()
A directed multigraph type.
|
static DefaultGraphType |
directedPseudograph()
A directed pseudograph type.
|
static DefaultGraphType |
directedSimple()
A directed simple graph type.
|
boolean |
isAllowingCycles()
Returns
true if and only if cycles are allowed in this graph. |
boolean |
isAllowingMultipleEdges()
Returns
true if and only if multiple (parallel) edges are allowed in this graph. |
boolean |
isAllowingSelfLoops()
Returns
true if and only if self-loops are allowed in this graph. |
boolean |
isDirected()
Returns true if all edges of the graph are directed, false otherwise.
|
boolean |
isMixed()
Returns true if the graph contain both directed and undirected edges, false otherwise.
|
boolean |
isModifiable()
Returns
true if the graph is modifiable, false otherwise. |
boolean |
isMultigraph()
Returns
true if the graph is a multigraph, false otherwise. |
boolean |
isPseudograph()
Returns
true if the graph is a pseudograph, false otherwise. |
boolean |
isSimple()
Returns
true if the graph is simple, false otherwise. |
boolean |
isUndirected()
Returns true if all edges of the graph are undirected, false otherwise.
|
boolean |
isWeighted()
Returns
true if and only if the graph supports edge weights. |
static DefaultGraphType |
mixed()
A mixed graph type.
|
static DefaultGraphType |
multigraph()
A multigraph type.
|
static DefaultGraphType |
pseudograph()
A pseudograph type.
|
static DefaultGraphType |
simple()
A simple graph type.
|
String |
toString() |
public boolean isDirected()
GraphTypeisDirected in interface GraphTypepublic boolean isUndirected()
GraphTypeisUndirected in interface GraphTypepublic boolean isMixed()
GraphTypepublic boolean isAllowingMultipleEdges()
GraphTypetrue if and only if multiple (parallel) edges are allowed in this graph.
The meaning of multiple edges is that there can be many edges going from vertex v1 to vertex
v2.isAllowingMultipleEdges in interface GraphTypetrue if and only if multiple (parallel) edges are allowed.public boolean isAllowingSelfLoops()
GraphTypetrue if and only if self-loops are allowed in this graph. A self loop is
an edge that its source and target vertices are the same.isAllowingSelfLoops in interface GraphTypetrue if and only if graph self-loops are allowed.public boolean isWeighted()
GraphTypetrue if and only if the graph supports edge weights.isWeighted in interface GraphTypetrue if the graph supports edge weights, false otherwise.public boolean isAllowingCycles()
GraphTypetrue if and only if cycles are allowed in this graph.isAllowingCycles in interface GraphTypetrue if and only if graph cycles are allowed.public boolean isModifiable()
GraphTypetrue if the graph is modifiable, false otherwise.isModifiable in interface GraphTypetrue if the graph is modifiable, false otherwisepublic boolean isSimple()
GraphTypetrue if the graph is simple, false otherwise.public boolean isPseudograph()
GraphTypetrue if the graph is a pseudograph, false otherwise.isPseudograph in interface GraphTypetrue if the graph is a pseudograph, false otherwisepublic boolean isMultigraph()
GraphTypetrue if the graph is a multigraph, false otherwise.isMultigraph in interface GraphTypetrue if the graph is a multigraph, false otherwisepublic GraphType asDirected()
GraphTypeasDirected in interface GraphTypepublic GraphType asUndirected()
GraphTypeasUndirected in interface GraphTypepublic GraphType asMixed()
GraphTypepublic GraphType asUnweighted()
GraphTypeasUnweighted in interface GraphTypepublic GraphType asWeighted()
GraphTypeasWeighted in interface GraphTypepublic GraphType asModifiable()
GraphTypeasModifiable in interface GraphTypepublic GraphType asUnmodifiable()
GraphTypeasUnmodifiable in interface GraphTypepublic static DefaultGraphType simple()
public static DefaultGraphType multigraph()
public static DefaultGraphType pseudograph()
public static DefaultGraphType directedSimple()
public static DefaultGraphType directedMultigraph()
public static DefaultGraphType directedPseudograph()
public static DefaultGraphType mixed()
public static DefaultGraphType dag()
Copyright © 2018. All rights reserved.