Class Edge

java.lang.Object
com.alexmerz.graphviz.objects.Edge

public class Edge extends Object
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 Details

    • Edge

      public Edge()
      Creates an empty edge object
    • Edge

      public Edge(PortNode source, PortNode target, int type)
      Creates an Edge
      Parameters:
      source - the source Node
      target - the target Node
      type - the edge type
  • Method Details

    • getSource

      public PortNode getSource()
      Returns the source node of the edge
      Returns:
      the source node
    • setSource

      public void setSource(PortNode source)
      Sets the source node of the edge
      Parameters:
      source - the source node
    • getTarget

      public PortNode getTarget()
      Returns the target node of the edge
      Returns:
      the target node
    • setTarget

      public void setTarget(PortNode target)
      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

      public String toString()
      Returns the String representation of the edge
      Overrides:
      toString in class Object
      Returns:
      the string representation
    • getAttribute

      public String getAttribute(String key)
      Returns the value of an edge attribute
      Parameters:
      key - the name of the attribute
      Returns:
      the value of the attribute
    • setAttribute

      public void setAttribute(String key, String value)
      Sets the value of an attribute
      Parameters:
      key - the name of the attribute
      value - the value of the attribute
    • getAttributes

      public Hashtable<String,String> getAttributes()
      Returns all attributes of this edge
      Returns:
      the attributes