org.eclipse.viatra.query.runtime.base.itc.graphimpl

## Class Graph<V>

- java.lang.Object
- - org.eclipse.viatra.query.runtime.base.itc.graphimpl.Graph<V>

- All Implemented Interfaces:
    java.io.Serializable, IBiDirectionalGraphDataSource<V>, IGraphDataSource<V>

      public class Graph<V>
      extends java.lang.Object
      implements IGraphDataSource<V>, IBiDirectionalGraphDataSource<V>

  See Also:
    Serialized Form

- - ### Constructor Summary

    Constructors
    Constructor and Description
    `Graph()`

  - ### Method Summary

    All Methods Instance Methods Concrete Methods
    Modifier and Type | Method and Description
    --- | ---
    `void` | `attachAsFirstObserver(IGraphObserver<V> observer)` Attaches a new graph observer to this graph data source as the first one.
    `void` | `attachObserver(IGraphObserver<V> go)` Attaches a new graph observer to this graph data source.
    `void` | `deleteEdge(V source, V target)`
    `void` | `deleteNode(V node)`
    `java.lang.Integer[]` | `deleteRandomEdge()`
    `void` | `detachObserver(IGraphObserver<V> go)` Detaches an already registered graph observer from this graph data source.
    `java.lang.String` | `generateDot()`
    `java.lang.String` | `generateDot(boolean colorSCCs, com.google.common.base.Function<V,java.lang.String> nameMapper, com.google.common.base.Function<V,java.lang.String> colorMapper)`
    `java.util.Set<V>` | `getAllNodes()` Returns the complete set of nodes in the graph data source.
    `java.util.Map<V,java.lang.Integer>` | `getSourceNodes(V target)` Returns the source nodes for the given target node.
    `java.util.Map<V,java.lang.Integer>` | `getTargetNodes(V source)` Returns the target nodes for the given source node.
    `void` | `insertEdge(V source, V target)`
    `void` | `insertNode(V node)`
    `java.lang.Integer[]` | `insertRandomEdge()`
    `java.lang.String` | `toString()`

    - ### Methods inherited from class java.lang.Object

      `clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait`

- - ### Constructor Detail

    - #### Graph

          public Graph()

  - ### Method Detail

    - #### insertEdge

          public void insertEdge(V source,
                                 V target)

    - #### deleteEdge

          public void deleteEdge(V source,
                                 V target)

    - #### insertNode

          public void insertNode(V node)

    - #### deleteNode

          public void deleteNode(V node)

    - #### attachObserver

          public void attachObserver(IGraphObserver<V> go)

      Description copied from interface: `IGraphDataSource`
      Attaches a new graph observer to this graph data source. Observers will be notified in the order they have been registered.
      Specified by:
        `attachObserver` in interface `IGraphDataSource<V>`
      Parameters:
        `go` - the graph observer

    - #### attachAsFirstObserver

          public void attachAsFirstObserver(IGraphObserver<V> observer)

      Description copied from interface: `IGraphDataSource`
      Attaches a new graph observer to this graph data source as the first one. In the notification order this observer will be the first one as long as another call to this method happens.
      Specified by:
        `attachAsFirstObserver` in interface `IGraphDataSource<V>`
      Parameters:
        `observer` - the graph observer

    - #### detachObserver

          public void detachObserver(IGraphObserver<V> go)

      Description copied from interface: `IGraphDataSource`
      Detaches an already registered graph observer from this graph data source.
      Specified by:
        `detachObserver` in interface `IGraphDataSource<V>`
      Parameters:
        `go` - the graph observer

    - #### getAllNodes

          public java.util.Set<V> getAllNodes()

      Description copied from interface: `IGraphDataSource`
      Returns the complete set of nodes in the graph data source.
      Specified by:
        `getAllNodes` in interface `IGraphDataSource<V>`
      Returns:
        the set of all nodes

    - #### getTargetNodes

          public java.util.Map<V,java.lang.Integer> getTargetNodes(V source)

      Description copied from interface: `IGraphDataSource`
      Returns the target nodes for the given source node. The returned data structure is a map (essentially a MultiSet) because of potential parallel edges in the graph data source. The values in the returned map represent the count of the given (source, target) edge. The method must not return null.
      Specified by:
        `getTargetNodes` in interface `IGraphDataSource<V>`
      Parameters:
        `source` - the source node
      Returns:
        the target nodes with their count values

    - #### getSourceNodes

          public java.util.Map<V,java.lang.Integer> getSourceNodes(V target)

      Description copied from interface: `IBiDirectionalGraphDataSource`
      Returns the source nodes for the given target node. The returned data structure is a map because of potential parallel edges in the graph data source. The values in the returned map represent the count of the given (source, target) edge. The method must not return null.
      Specified by:
        `getSourceNodes` in interface `IBiDirectionalGraphDataSource<V>`
      Parameters:
        `target` - the target node
      Returns:
        the source nodes with their count values

    - #### toString

          public java.lang.String toString()

      Overrides:
        `toString` in class `java.lang.Object`

    - #### generateDot

          public java.lang.String generateDot(boolean colorSCCs,
                                              com.google.common.base.Function<V,java.lang.String> nameMapper,
                                              com.google.common.base.Function<V,java.lang.String> colorMapper)

      Since:
        1.6

    - #### generateDot

          public java.lang.String generateDot()

      Since:
        1.6

    - #### deleteRandomEdge

          public java.lang.Integer[] deleteRandomEdge()

    - #### insertRandomEdge

          public java.lang.Integer[] insertRandomEdge()