Class RandomGraphGenerator.DefaultEdgeTopologyFactory<VV,​EE>

  • All Implemented Interfaces:
    RandomGraphGenerator.EdgeTopologyFactory<VV,​EE>
    Enclosing class:
    RandomGraphGenerator<V,​E>

    public class RandomGraphGenerator.DefaultEdgeTopologyFactory<VV,​EE>
    extends java.lang.Object
    implements RandomGraphGenerator.EdgeTopologyFactory<VV,​EE>
    Default implementation of the EdgeTopologyFactory interface. randomly chooses an edge and tries to add it. If the add fails from any reason (like: self edge / multiple edges in unpermitted graph type) it will just choose another and try again. Performance:
  • when the number of possible edges becomes slim , this class will have a very poor performance , cause it will not use gready methods to choose them. for example : In simple graph , if #V = N (#x = number Of x) and we want full mesh #edges= N*(N-1)/2 , the first added edges will do so quickly (O(1) , the last will take O(N^2). So , do not use it in this kind of graphs.
  • If the numberOfEdges is bigger than what the graph can add, there will be an infinite loop here. It is not tested.
Since:
Aug 6, 2005
Author:
Assaf