Esempio n. 1
0
        private IList <WpfGraph> GetConnectedComponents(IGraph graph)
        {
            var scc          = graph.GetStronglyConnectedComponents().Where(c => c.Count > 1).ToList();
            var sccGraphs    = scc.Select(graph.GetReducedGraph).ToList();
            var wpfGraphList = sccGraphs
                               .Select(g => new WpfGraph(GraphParser.GetGraphLayout(g.ToDot())))
                               .ToList();

            return(wpfGraphList);
        }
Esempio n. 2
0
        public SimpleController()
        {
            if (Environment.GetCommandLineArgs().Length <= 1)
            {
                throw new ArgumentException("No filename argument given!");
            }
            var filename   = Environment.GetCommandLineArgs()[1];
            var dotContent = File.ReadAllText(filename);

            try {
                GraphParser.CheckSyntax(dotContent);
            } catch (Exception e) {
                throw new ArgumentException("Invalid graph syntax:" + Environment.NewLine + e.Message);
            }
            var graph       = GraphParser.GetGraph(dotContent);
            var layoutGraph = GraphParser.GetGraphLayout(graph.ToDot());

            Graph = new WpfGraph(layoutGraph);
        }