コード例 #1
0
ファイル: Problem.cs プロジェクト: wcatykid/GeoShader
        public Problem(Problem <A> thatProblem)
        {
            givens = new List <int>(thatProblem.givens);
            goal   = thatProblem.goal;

            path             = new List <int>(thatProblem.path);
            edges            = new List <PebblerHyperEdge <A> >(thatProblem.edges);
            suppressedGivens = new List <int>(thatProblem.suppressedGivens);

            graph = new DiGraph(thatProblem.graph);
        }
コード例 #2
0
ファイル: Problem.cs プロジェクト: wcatykid/GeoShader
        // For backward problem generation
        public Problem()
        {
            givens = new List <int>();
            goal   = -1;

            path             = new List <int>();
            edges            = new List <PebblerHyperEdge <A> >();
            suppressedGivens = new List <int>();

            graph = new DiGraph();
        }
コード例 #3
0
ファイル: Problem.cs プロジェクト: wcatykid/GeoShader
        public Problem(PebblerHyperEdge <A> edge)
        {
            givens = new List <int>(edge.sourceNodes);
            goal   = edge.targetNode;

            path  = new List <int>();
            edges = new List <PebblerHyperEdge <A> >();
            edges.Add(edge);

            suppressedGivens = new List <int>();

            graph = new DiGraph();
            graph.AddHyperEdge(givens, goal);
        }
コード例 #4
0
ファイル: DiGraph.cs プロジェクト: wcatykid/GeoShader
        //
        // Make a shallow copy of this graph (all vertices and edges)
        //
        public DiGraph(DiGraph thatGraph)
        {
            edgeMap = new Dictionary<int, List<int>>();
            transposeEdgeMap = new Dictionary<int, List<int>>();
            numEdges = thatGraph.numEdges;
            vertices = new List<int>(thatGraph.vertices);

            // Copy the integer indices
            foreach (KeyValuePair<int, List<int>> pair in thatGraph.edgeMap)
            {
                edgeMap.Add(pair.Key, new List<int>(pair.Value));
            }

            // Copy the integer indices
            foreach (KeyValuePair<int, List<int>> pair in thatGraph.transposeEdgeMap)
            {
                transposeEdgeMap.Add(pair.Key, new List<int>(pair.Value));
            }

            sccs = GetStronglyConnectedComponents();
        }
コード例 #5
0
ファイル: DiGraph.cs プロジェクト: wcatykid/GeoShader
        //
        // Make a shallow copy of this graph (all vertices and edges)
        //
        public DiGraph(DiGraph thatGraph)
        {
            edgeMap          = new Dictionary <int, List <int> >();
            transposeEdgeMap = new Dictionary <int, List <int> >();
            numEdges         = thatGraph.numEdges;
            vertices         = new List <int>(thatGraph.vertices);

            // Copy the integer indices
            foreach (KeyValuePair <int, List <int> > pair in thatGraph.edgeMap)
            {
                edgeMap.Add(pair.Key, new List <int>(pair.Value));
            }

            // Copy the integer indices
            foreach (KeyValuePair <int, List <int> > pair in thatGraph.transposeEdgeMap)
            {
                transposeEdgeMap.Add(pair.Key, new List <int>(pair.Value));
            }

            sccs = GetStronglyConnectedComponents();
        }