 java.lang.Object

 org.jgrapht.graph.DefaultGraphType

 All Implemented Interfaces:
java.io.Serializable
,GraphType
public class DefaultGraphType extends java.lang.Object implements GraphType, java.io.Serializable
Default implementation of the graph type.The graph type describes various properties of a graph such as whether it is directed, undirected or mixed, whether it contain selfloops (a selfloop 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
 See Also:
 Serialized Form


Nested Class Summary
Nested Classes Modifier and Type Class Description static class
DefaultGraphType.Builder
A builder forDefaultGraphType
.

Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method 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()
Returnstrue
if and only if cycles are allowed in this graph.boolean
isAllowingMultipleEdges()
Returnstrue
if and only if multiple (parallel) edges are allowed in this graph.boolean
isAllowingSelfLoops()
Returnstrue
if and only if selfloops 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()
Returnstrue
if the graph is modifiable,false
otherwise.boolean
isMultigraph()
Returnstrue
if the graph is a multigraph,false
otherwise.boolean
isPseudograph()
Returnstrue
if the graph is a pseudograph,false
otherwise.boolean
isSimple()
Returnstrue
if the graph is simple,false
otherwise.boolean
isUndirected()
Returns true if all edges of the graph are undirected, false otherwise.boolean
isWeighted()
Returnstrue
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.java.lang.String
toString()



Method Detail

isDirected
public boolean isDirected()
Description copied from interface:GraphType
Returns true if all edges of the graph are directed, false otherwise. Specified by:
isDirected
in interfaceGraphType
 Returns:
 true if all edges of the graph are directed, false otherwise

isUndirected
public boolean isUndirected()
Description copied from interface:GraphType
Returns true if all edges of the graph are undirected, false otherwise. Specified by:
isUndirected
in interfaceGraphType
 Returns:
 true if all edges of the graph are undirected, false otherwise

isMixed
public boolean isMixed()
Description copied from interface:GraphType
Returns true if the graph contain both directed and undirected edges, false otherwise.

isAllowingMultipleEdges
public boolean isAllowingMultipleEdges()
Description copied from interface:GraphType
Returnstrue
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. Specified by:
isAllowingMultipleEdges
in interfaceGraphType
 Returns:
true
if and only if multiple (parallel) edges are allowed.

isAllowingSelfLoops
public boolean isAllowingSelfLoops()
Description copied from interface:GraphType
Returnstrue
if and only if selfloops are allowed in this graph. A self loop is an edge that its source and target vertices are the same. Specified by:
isAllowingSelfLoops
in interfaceGraphType
 Returns:
true
if and only if graph selfloops are allowed.

isWeighted
public boolean isWeighted()
Description copied from interface:GraphType
Returnstrue
if and only if the graph supports edge weights. Specified by:
isWeighted
in interfaceGraphType
 Returns:
true
if the graph supports edge weights,false
otherwise.

isAllowingCycles
public boolean isAllowingCycles()
Description copied from interface:GraphType
Returnstrue
if and only if cycles are allowed in this graph. Specified by:
isAllowingCycles
in interfaceGraphType
 Returns:
true
if and only if graph cycles are allowed.

isModifiable
public boolean isModifiable()
Description copied from interface:GraphType
Returnstrue
if the graph is modifiable,false
otherwise. Specified by:
isModifiable
in interfaceGraphType
 Returns:
true
if the graph is modifiable,false
otherwise

isSimple
public boolean isSimple()
Description copied from interface:GraphType
Returnstrue
if the graph is simple,false
otherwise.

isPseudograph
public boolean isPseudograph()
Description copied from interface:GraphType
Returnstrue
if the graph is a pseudograph,false
otherwise. Specified by:
isPseudograph
in interfaceGraphType
 Returns:
true
if the graph is a pseudograph,false
otherwise

isMultigraph
public boolean isMultigraph()
Description copied from interface:GraphType
Returnstrue
if the graph is a multigraph,false
otherwise. Specified by:
isMultigraph
in interfaceGraphType
 Returns:
true
if the graph is a multigraph,false
otherwise

asDirected
public GraphType asDirected()
Description copied from interface:GraphType
Create a directed variant of the current graph type. Specified by:
asDirected
in interfaceGraphType
 Returns:
 a directed variant of the current graph type

asUndirected
public GraphType asUndirected()
Description copied from interface:GraphType
Create an undirected variant of the current graph type. Specified by:
asUndirected
in interfaceGraphType
 Returns:
 an undirected variant of the current graph type

asMixed
public GraphType asMixed()
Description copied from interface:GraphType
Create a mixed variant of the current graph type.

asUnweighted
public GraphType asUnweighted()
Description copied from interface:GraphType
Create an unweighted variant of the current graph type. Specified by:
asUnweighted
in interfaceGraphType
 Returns:
 an unweighted variant of the current graph type

asWeighted
public GraphType asWeighted()
Description copied from interface:GraphType
Create a weighted variant of the current graph type. Specified by:
asWeighted
in interfaceGraphType
 Returns:
 a weighted variant of the current graph type

asModifiable
public GraphType asModifiable()
Description copied from interface:GraphType
Create a modifiable variant of the current graph type. Specified by:
asModifiable
in interfaceGraphType
 Returns:
 a modifiable variant of the current graph type

asUnmodifiable
public GraphType asUnmodifiable()
Description copied from interface:GraphType
Create an unmodifiable variant of the current graph type. Specified by:
asUnmodifiable
in interfaceGraphType
 Returns:
 a unmodifiable variant of the current graph type

simple
public static DefaultGraphType simple()
A simple graph type. An undirected graph for which at most one edge connects any two vertices, and selfloops are not permitted. Returns:
 a simple graph type

multigraph
public static DefaultGraphType multigraph()
A multigraph type. A nonsimple undirected graph in which no selfloops are permitted, but multiple edges between any two vertices are. Returns:
 a multigraph type

pseudograph
public static DefaultGraphType pseudograph()
A pseudograph type. A nonsimple undirected graph in which both graph selfloops and multiple edges are permitted. Returns:
 a pseudograph type

directedSimple
public static DefaultGraphType directedSimple()
A directed simple graph type. An undirected graph for which at most one edge connects any two vertices, and selfloops are not permitted. Returns:
 a directed simple graph type

directedMultigraph
public static DefaultGraphType directedMultigraph()
A directed multigraph type. A nonsimple undirected graph in which no selfloops are permitted, but multiple edges between any two vertices are. Returns:
 a directed multigraph type

directedPseudograph
public static DefaultGraphType directedPseudograph()
A directed pseudograph type. A nonsimple undirected graph in which both graph selfloops and multiple edges are permitted. Returns:
 a directed pseudograph type

mixed
public static DefaultGraphType mixed()
A mixed graph type. A graph having a set of undirected and a set of directed edges, which may contain selfloops and multiple edges are permitted. Returns:
 a mixed graph type

dag
public static DefaultGraphType dag()
A directed acyclic graph. Returns:
 a directed acyclic graph type

toString
public java.lang.String toString()
 Overrides:
toString
in classjava.lang.Object

