Beispiel #1
0
 private void CheckDAG(IVertexAndEdgeListGraph <string, Edge <string> > g)
 {
     // check it's a dag
     try
     {
         AlgoUtility.TopologicalSort(this.algo.CondensatedGraph);
     }
     catch (NonAcyclicGraphException)
     {
         Assert.Fail("Graph is not a DAG.");
     }
 }
Beispiel #2
0
        /// <summary>
        /// Generate file containing command lines to run ikvmc including names of referenced dlls.
        /// </summary>
        /// <param name="g"></param>
        /// <param name="path"></param>
        private static void GenerateIkvmcRunScript(BidirectionalGraph <string, Edge <string> > g, string path)
        {
            StreamWriter sw = new StreamWriter(path);

            foreach (string vertex in AlgoUtility.TopologicalSort <string, Edge <string> >(g))
            {
                IEnumerable <string> names = g.InEdges(vertex).Select <Edge <string>, string>(item => item.Source);

                string references = "";
                foreach (string name in names)
                {
                    references += " -r:" + name.Replace(".jar", ".dll");
                }
                string commandLine = "ikvmc " + vertex + " -target:library" + references;
                sw.WriteLine(commandLine);
            }
            sw.Close();
        }
        public void ComputeNoInit(TVertex s)
        {
            ICollection <TVertex> orderedVertices = AlgoUtility.TopologicalSort <TVertex, TEdge>(this.VisitedGraph);

            OnDiscoverVertex(s);
            foreach (TVertex v in orderedVertices)
            {
                OnExamineVertex(v);
                foreach (TEdge e in VisitedGraph.OutEdges(v))
                {
                    OnDiscoverVertex(e.Target);
                    bool decreased = Relax(e);
                    if (decreased)
                    {
                        OnTreeEdge(e);
                    }
                    else
                    {
                        OnEdgeNotRelaxed(e);
                    }
                }
                OnFinishVertex(v);
            }
        }