Package org.jgrapht
Interface GraphType
-
- All Known Implementing Classes:
DefaultGraphType
public interface GraphTypeA graph type.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.- Author:
- Dimitrios Michail
-
-
Method Summary
All Methods Instance Methods Abstract Methods Modifier and Type Method Description GraphTypeasDirected()Create a directed variant of the current graph type.GraphTypeasMixed()Create a mixed variant of the current graph type.GraphTypeasModifiable()Create a modifiable variant of the current graph type.GraphTypeasUndirected()Create an undirected variant of the current graph type.GraphTypeasUnmodifiable()Create an unmodifiable variant of the current graph type.GraphTypeasUnweighted()Create an unweighted variant of the current graph type.GraphTypeasWeighted()Create a weighted variant of the current graph type.booleanisAllowingCycles()Returnstrueif and only if cycles are allowed in this graph.booleanisAllowingMultipleEdges()Returnstrueif and only if multiple (parallel) edges are allowed in this graph.booleanisAllowingSelfLoops()Returnstrueif and only if self-loops are allowed in this graph.booleanisDirected()Returns true if all edges of the graph are directed, false otherwise.booleanisMixed()Returns true if the graph contain both directed and undirected edges, false otherwise.booleanisModifiable()Returnstrueif the graph is modifiable,falseotherwise.booleanisMultigraph()Returnstrueif the graph is a multigraph,falseotherwise.booleanisPseudograph()Returnstrueif the graph is a pseudograph,falseotherwise.booleanisSimple()Returnstrueif the graph is simple,falseotherwise.booleanisUndirected()Returns true if all edges of the graph are undirected, false otherwise.booleanisWeighted()Returnstrueif and only if the graph supports edge weights.
-
-
-
Method Detail
-
isDirected
boolean isDirected()
Returns true if all edges of the graph are directed, false otherwise.- Returns:
- true if all edges of the graph are directed, false otherwise
-
isUndirected
boolean isUndirected()
Returns true if all edges of the graph are undirected, false otherwise.- Returns:
- true if all edges of the graph are undirected, false otherwise
-
isMixed
boolean isMixed()
Returns true if the graph contain both directed and undirected edges, false otherwise.- Returns:
- true if the graph contain both directed and undirected edges, false otherwise
-
isAllowingMultipleEdges
boolean isAllowingMultipleEdges()
Returnstrueif 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.- Returns:
trueif and only if multiple (parallel) edges are allowed.
-
isAllowingSelfLoops
boolean isAllowingSelfLoops()
Returnstrueif 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.- Returns:
trueif and only if graph self-loops are allowed.
-
isAllowingCycles
boolean isAllowingCycles()
Returnstrueif and only if cycles are allowed in this graph.- Returns:
trueif and only if graph cycles are allowed.
-
isWeighted
boolean isWeighted()
Returnstrueif and only if the graph supports edge weights.- Returns:
trueif the graph supports edge weights,falseotherwise.
-
isSimple
boolean isSimple()
Returnstrueif the graph is simple,falseotherwise.- Returns:
trueif the graph is simple,falseotherwise
-
isPseudograph
boolean isPseudograph()
Returnstrueif the graph is a pseudograph,falseotherwise.- Returns:
trueif the graph is a pseudograph,falseotherwise
-
isMultigraph
boolean isMultigraph()
Returnstrueif the graph is a multigraph,falseotherwise.- Returns:
trueif the graph is a multigraph,falseotherwise
-
isModifiable
boolean isModifiable()
Returnstrueif the graph is modifiable,falseotherwise.- Returns:
trueif the graph is modifiable,falseotherwise
-
asDirected
GraphType asDirected()
Create a directed variant of the current graph type.- Returns:
- a directed variant of the current graph type
-
asUndirected
GraphType asUndirected()
Create an undirected variant of the current graph type.- Returns:
- an undirected variant of the current graph type
-
asMixed
GraphType asMixed()
Create a mixed variant of the current graph type.- Returns:
- a mixed variant of the current graph type
-
asUnweighted
GraphType asUnweighted()
Create an unweighted variant of the current graph type.- Returns:
- an unweighted variant of the current graph type
-
asWeighted
GraphType asWeighted()
Create a weighted variant of the current graph type.- Returns:
- a weighted variant of the current graph type
-
asModifiable
GraphType asModifiable()
Create a modifiable variant of the current graph type.- Returns:
- a modifiable variant of the current graph type
-
asUnmodifiable
GraphType asUnmodifiable()
Create an unmodifiable variant of the current graph type.- Returns:
- a unmodifiable variant of the current graph type
-
-