public void Generate(int nodeCount, int edgeCount, bool directed)
        {
            RandomGeneratorBasicAdjList rgg = new RandomGeneratorBasicAdjList();
            rgg.NodeCount = nodeCount;
            rgg.EdgeCount = edgeCount;
            rgg.IsDirected = directed;
            IBasicAdjList result = rgg.Generate(Guid.NewGuid()) as IBasicAdjList;

            Assert.NotNull(result);
            Assert.Equal(nodeCount, result.NodeCount);
            Assert.Equal(edgeCount, result.EdgeCount);
            Assert.Equal(directed, result.IsDirected);
        }
Beispiel #2
0
        /// <summary>
        /// Creates an IBasicAdjList with n nodes, m edges, and nodeDataAttribs, edgeDataAttribs determine
        /// if it can hold data attribustes
        /// </summary>
        /// <param name="n">number of nodes</param>
        /// <param name="m">number of edges</param>
        /// <param name="directed">directed or not</param>
        /// <param name="enableNodeDataAttribs">if true, add node data attrib capability</param>
        /// <param name="enableEdgeDataAttribs">if true, add edge data attrib capability</param>
        /// <returns></returns>
        public static IBasicAdjList GenerateAdjListWithDataAttribs(int n, int m, bool directed, bool enableNodeDataAttribs, bool enableEdgeDataAttribs)
        {
            var rgg = new RandomGeneratorBasicAdjList();
            rgg.NodeCount = n;
            rgg.EdgeCount = m;
            rgg.AllowCycles = AllowCycles;
            rgg.AllowSelfLoops = AllowSelfLoops;
            rgg.AllowMultiEdges = AllowMultiEdges;
            rgg.IsDirected = directed;
            BasicAdjList net = (BasicAdjList)rgg.Generate(NextId);

            using (var fac = new DataAttributeTableFactory(net))
               {
                   if (enableNodeDataAttribs)
                       fac.CreateNodeDataTable();
                   if (enableEdgeDataAttribs)
                       fac.CreateEdgeDataTable();
                }
            GarunteeEdgeCount(net, m);

            return net;
        }
Beispiel #3
0
        public static IBasicAdjList GenerateAdjList(Guid id, int n, int m, bool directed, bool allowSelfLoops, bool allowCycles, bool allowMultiEdges)
        {
            var rgg = new RandomGeneratorBasicAdjList();
            rgg.NodeCount = n;
            rgg.EdgeCount = m;
            rgg.AllowCycles = allowCycles;
            rgg.AllowSelfLoops = allowSelfLoops;
            rgg.AllowMultiEdges = allowMultiEdges;
            rgg.IsDirected = directed;
            BasicAdjList net = (BasicAdjList)rgg.Generate(id);

            return net;
        }
Beispiel #4
0
        public static IBasicAdjList GenerateAdjList(int n, int m, bool directed)
        {
            var rgg = new RandomGeneratorBasicAdjList();
            rgg.NodeCount = n;
            rgg.EdgeCount = m;
            rgg.AllowCycles = AllowCycles;
            rgg.AllowSelfLoops = AllowSelfLoops;
            rgg.AllowMultiEdges = AllowMultiEdges;
            rgg.IsDirected = directed;
            BasicAdjList net = (BasicAdjList)rgg.Generate(Guid.NewGuid());
            GarunteeEdgeCount(net, m);

            return net;
        }