Interface Graph.Vertex<ID>

Type Parameters:
ID - type of identifier
All Known Implementing Classes:
AbstractGraph.SimpleVertex
Enclosing interface:
Graph<ID>

public static interface Graph.Vertex<ID>
Vertex of graph. A vertex must have an identifier unique to all vertices in the graph.
  • Method Details

    • getId

      ID getId()
      returns identifier of vertex.
      Returns:
      identifier of vertex
    • setId

      void setId(ID id)
      sets identifier of vertex.
      Parameters:
      id - identifier of vertex
      Throws:
      NullPointerException - if id is null
      IllegalArgumentException - if a vertex with id already exists in the graph
    • id

      Graph.Vertex<ID> id(ID id)
      sets identifier of this vertex. This vertex is returned.
      Parameters:
      id - identifier of vertex.
      Returns:
      this vertex
      Throws:
      NullPointerException - if id is null
      IllegalArgumentException - if a vertex with id already exists in the graph
    • connectsTo

      Graph.Vertex<ID> connectsTo(ID to)
      Ensures this vertex connects to the vertex with an 'id' property equal to the 'to' parameter. The edge or vertex is created if needed. This vertex is returned.

      If a vertex is created its 'id' property will be set to the 'to' parameter. If an edge is created the 'from' property is set to the 'id' of this vertex and the 'to' property is set to the 'id' of the 'to' vertex.

      If this graph is undirected and contains an edge connecting this vertex with 'to' the edge will not be created. Undirected graphs ignore 'from'/'to' order in edges.

      Parameters:
      to - vertex id
      Returns:
      this vertex
      Throws:
      NullPointerException - if to is null
    • connectsFrom

      Graph.Vertex<ID> connectsFrom(ID from)
      Ensures this vertex connects to the vertex with an 'id' property equal to the 'from' parameter. The edge or vertex is created if needed. This vertex is returned.

      If a vertex is created its 'id' property will be set to the 'from' parameter. If an edge is created the 'from' property is set to the 'id' of the 'from' vertex and the 'to' property is set to the 'id' of this vertex.

      If this graph is undirected and contains an edge connecting this vertex with 'from' the edge will not be created. Undirected graphs ignore 'from'/'to' order in edges.

      Parameters:
      from - vertex id
      Returns:
      this vertex
      Throws:
      NullPointerException - if from is null
    • adjacentEdges

      Set<Graph.Edge<ID>> adjacentEdges()
      Returns the set of all edges connecting to this vertex.
      Returns:
      set of adjacent edges
    • inEdges

      Set<Graph.Edge<ID>> inEdges()
      Returns the set of edges connecting to this vertex where 'to' is the 'id' of this vertex
      Returns:
      incoming edges
    • outEdges

      Set<Graph.Edge<ID>> outEdges()
      Returns the set of edges connecting to this vertex where 'from' is the 'id' of this vertex
      Returns:
      outgoing edges
    • findProperty

      <T> Optional<T> findProperty(String name)
      Returns Optional of a property. If the property does not exist the returned Optional is empty.

      A property is resolved by first checking properties set on this vertex. If the local property does not exist vertexProperties in the graph are checked.

      Parameters:
      name - of property
      Returns:
      optional of named property
      Throws:
      NullPointerException - if name is null
    • getProperty

      <T> T getProperty(String name)
      Returns a property. If the property does not exist null is returned.

      A property is resolved by first checking properties set on this vertex. If the local proeprty does not exist vertexProperties in the graph are checked.

      Type Parameters:
      T - return type of property
      Parameters:
      name - of property
      Returns:
      value of named property
      Throws:
      NullPointerException - if name is null
    • setProperty

      void setProperty(String name, Object value)
      Sets the value of a local property.
      Parameters:
      name - of property
      value - of property
      Throws:
      NullPointerException - if name or value is null
    • property

      Graph.Vertex<ID> property(String name, Object value)
      Sets the value of a local property returning this vertex.
      Parameters:
      name - of property
      value - of property
      Returns:
      this vertex
      Throws:
      NullPointerException - if name or value is null
    • property

      Graph.Vertex<ID> property(String name1, Object value1, String name2, Object value2)
    • property

      Graph.Vertex<ID> property(String name1, Object value1, String name2, Object value2, String name3, Object value3)
    • property

      Graph.Vertex<ID> property(String name1, Object value1, String name2, Object value2, String name3, Object value3, String name4, Object value4)
    • property

      Graph.Vertex<ID> property(String name1, Object value1, String name2, Object value2, String name3, Object value3, String name4, Object value4, String name5, Object value5)
    • property

      Graph.Vertex<ID> property(String name1, Object value1, String name2, Object value2, String name3, Object value3, String name4, Object value4, String name5, Object value5, String name6, Object value6)
    • property

      Graph.Vertex<ID> property(String name1, Object value1, String name2, Object value2, String name3, Object value3, String name4, Object value4, String name5, Object value5, String name6, Object value6, String name7, Object value7)
    • property

      Graph.Vertex<ID> property(String name1, Object value1, String name2, Object value2, String name3, Object value3, String name4, Object value4, String name5, Object value5, String name6, Object value6, String name7, Object value7, String name8, Object value8)
    • property

      Graph.Vertex<ID> property(String name1, Object value1, String name2, Object value2, String name3, Object value3, String name4, Object value4, String name5, Object value5, String name6, Object value6, String name7, Object value7, String name8, Object value8, String name9, Object value9)
    • property

      Graph.Vertex<ID> property(String name1, Object value1, String name2, Object value2, String name3, Object value3, String name4, Object value4, String name5, Object value5, String name6, Object value6, String name7, Object value7, String name8, Object value8, String name9, Object value9, String name10, Object value10)
    • property

      Graph.Vertex<ID> property(Map<String,Object> properties)
    • removeProperty

      Graph.Vertex<ID> removeProperty(String name)
      Removes property from local properties returning this vertex.
      Parameters:
      name - of property
      Returns:
      this vertex
      Throws:
      NullPointerException - if name is null
    • inherited

      Map<String,Object> inherited()
      Returns an unmodifiable map of inherited properties
      Returns:
      map of inherited properties
    • local

      Map<String,Object> local()
      Returns an unmodifiable map of local properties
      Returns:
      map of local properties
    • remove

      Graph.Vertex<ID> remove()
      Removes this vertex from the graph.
      Returns:
      tis vertex
    • connected

      boolean connected(ID id)
      Returns true if this vertex and 'id' vertex is connected.
      Parameters:
      id - of vertex
      Returns:
      true if the two vertices are connected