Esempio n. 1
0
    // Use this for initialization
    void Awake()
    {
        // input_graph_orient_acycle
        // input_graph_Grigoriev2
        //var textfile = Resources.Load("input_graph_Grigoriev2.txt");
        g_Graph    = new G_Graph("C:/WithoutPermission/graph.txt");
        graphNodes = new List <GameObject>();
        gr2scene   = new Dictionary <Node, GameObject>();
        scene2gr   = new Dictionary <GameObject, Node>();

        e_gr2scene = new Dictionary <EdgeTo, GameObject>();
        e_scene2gr = new Dictionary <GameObject, EdgeTo>();
        e_edgeFrom = new Dictionary <GameObject, Node>();
        //print(g_Graph.GetGraph().Keys.Count);
    }
Esempio n. 2
0
    void InitKarkas()
    {
        karkas = G_Graph.Boruv(g_Graph);
        // Костыльно но сойдет
        var k_graph = karkas.GetGraph();
        var occurs  = new Dictionary <string, int>();

        // Инициализация подсчета вершин
        foreach (var node in k_graph.Keys)
        {
            occurs.Add(node.GetName(), 0);
        }
        foreach (var node in k_graph.Keys)
        {
            foreach (var edge in k_graph[node])
            {
                occurs[node.GetName()]++;
                occurs[edge.GetNodeTo().GetName()]++;
            }
        }
        trueAnswer = occurs;
    }