作为我第一次使用 C#(在 Mono 2.6.7 上)实验的一部分,我正在尝试使用 QuickGraph 中的 StronglyConnectedComponents 方法。这是我的代码:
using System;
using QuickGraph;
using QuickGraph.Data;
using System.Collections.Generic;
using QuickGraph.Algorithms;
namespace Graph
{
class MainClass
{
public static void Main (string[] args)
{
IVertexListGraph<int,Edge<int>> graph;
graph = new AdjacencyGraph<int,Edge<int>>();
IDictionary<int,int> components=new Dictionary<int,int>();
int noc = graph.StronglyConnectedComponents(out components);
}
}
}
尝试编译上面的代码时,我收到错误消息(在 MonoDevelop 中):
Error CS1061: Type `QuickGraph.IVertexListGraph<int,QuickGraph.Edge<int>>' does not
contain a definition for `StronglyConnectedComponents' and no extension method
`StronglyConnectedComponents' of type
`QuickGraph.IVertexListGraph<int,QuickGraph.Edge<int>>' could be found
(are you missing a using directive or an assembly reference?) (CS1061) (Graph)
至于我从文档中可以看到,扩展方法应该是可用的:
public static int StronglyConnectedComponents<TVertex, TEdge>(
IVertexListGraph<TVertex, TEdge> g,
out IDictionary<TVertex, int> components
)
另外,我引用了 QuickGraph 中的所有三个 .dll。我错过了什么?