Package com.alexmerz.graphviz.objects
Class Edge
java.lang.Object
com.alexmerz.graphviz.objects.Edge
This class represents an Edge in a Graph.
Each Edge has a source Node and a target Node.
Both nodes may contain port information.
The type attribute is currently a nice-to-have
because only directed edges are only allowed
in 'Digraphs', and undirected in 'Graphs'.
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptiongetAttribute(String key) Returns the value of an edge attributeReturns all attributes of this edgeReturns the source node of the edgeReturns the target node of the edgeintgetType()Returns the type of the edge.voidsetAttribute(String key, String value) Sets the value of an attributevoidSets the source node of the edgevoidSets the target node of the edgevoidsetType(int type) Sets the type of the edgetoString()Returns the String representation of the edge
-
Constructor Details
-
Edge
public Edge()Creates an empty edge object -
Edge
Creates an Edge- Parameters:
source- the source Nodetarget- the target Nodetype- the edge type
-
-
Method Details
-
getSource
Returns the source node of the edge- Returns:
- the source node
-
setSource
Sets the source node of the edge- Parameters:
source- the source node
-
getTarget
Returns the target node of the edge- Returns:
- the target node
-
setTarget
Sets the target node of the edge- Parameters:
target- the target Node
-
getType
public int getType()Returns the type of the edge.- Returns:
- the type of the edge
- See Also:
-
setType
public void setType(int type) Sets the type of the edge- Parameters:
type- the type of the edge- See Also:
-
toString
Returns the String representation of the edge -
getAttribute
Returns the value of an edge attribute- Parameters:
key- the name of the attribute- Returns:
- the value of the attribute
-
setAttribute
Sets the value of an attribute- Parameters:
key- the name of the attributevalue- the value of the attribute
-
getAttributes
Returns all attributes of this edge- Returns:
- the attributes
-