Class Graphs

java.lang.Object
org.graphstream.graph.implementations.Graphs

public class Graphs
extends Object
  • Constructor Details

  • Method Details

    • unmutableGraph

      public static Graph unmutableGraph​(Graph g)
    • synchronizedGraph

      public static Graph synchronizedGraph​(Graph g)
      Synchronizes a graph. The returned graph can be accessed and modified by several threads. You lose genericity in methods returning edge or node because each element (graph, nodes and edges) is wrapped into a synchronized wrapper which breaks original elements class.
      Parameters:
      g - the graph to synchronize
      Returns:
      a synchronized wrapper for g
    • merge

      public static Graph merge​(Graph... graphs)
      Merge several graphs in one. A new graph is created, that will contain the result. The method will try to create a graph of the same class that the first graph to merge (it needs to have a constructor with a String). Else, a MultiGraph is used.
      Parameters:
      graphs - graphs to merge
      Returns:
      merge result
    • mergeIn

      public static void mergeIn​(Graph result, Graph... graphs)
      Merge several graphs in one. The first parameter is the graph in which the other graphs will be merged.
      Parameters:
      result - destination graph.
      graphs - all graphs that will be merged in result.
    • clone

      public static Graph clone​(Graph g)
      Clone a given graph with same node/edge structure and same attributes.
      Parameters:
      g - the graph to clone
      Returns:
      a copy of g
    • copyAttributes

      public static void copyAttributes​(Element source, Element target)
      Parameters:
      source -
      target -