public interface GraphType
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 | 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.
|
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. |
boolean isDirected()
boolean isUndirected()
boolean isMixed()
boolean isAllowingMultipleEdges()
true
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.true
if and only if multiple (parallel) edges are allowed.boolean isAllowingSelfLoops()
true
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.true
if and only if graph self-loops are allowed.boolean isAllowingCycles()
true
if and only if cycles are allowed in this graph.true
if and only if graph cycles are allowed.boolean isWeighted()
true
if and only if the graph supports edge weights.true
if the graph supports edge weights, false
otherwise.boolean isSimple()
true
if the graph is simple, false
otherwise.true
if the graph is simple, false
otherwiseboolean isPseudograph()
true
if the graph is a pseudograph, false
otherwise.true
if the graph is a pseudograph, false
otherwiseboolean isMultigraph()
true
if the graph is a multigraph, false
otherwise.true
if the graph is a multigraph, false
otherwiseboolean isModifiable()
true
if the graph is modifiable, false
otherwise.true
if the graph is modifiable, false
otherwiseGraphType asDirected()
GraphType asUndirected()
GraphType asMixed()
GraphType asUnweighted()
GraphType asWeighted()
GraphType asModifiable()
GraphType asUnmodifiable()
Copyright © 2019. All rights reserved.