了解 Donald B. Johnson 算法中的伪代码
有谁知道 Donald B. Johnson 算法,它枚举了所有基本电路(循环) )在有向图中?
我有他 1975 年发表的论文,但我看不懂伪代码。
我的目标是用 Java 实现这个算法。
例如,我有一些问题,它所指的矩阵 Ak 是什么。在伪代码中,它提到
Ak:=adjacency structure of strong component K with least
vertex in subgraph of G induced by {s,s+1,....n};
这是否意味着我必须实现另一个算法来查找 Ak 矩阵?
还有一个问题就是下面这句话是什么意思?
begin logical f;
“逻辑过程 CIRCUIT (整数值 v);”行是否也意味着电路过程返回一个逻辑变量?在伪代码中还有一行“CIRCUIT := f;
”。这意味着什么?
如果有人可以将这个 1970 年代的伪代码翻译成更现代类型的伪代码,这样我就可以理解它,那就太好了。
如果您有兴趣提供帮助,但找不到这篇论文,请给我发电子邮件 [电子邮件受保护],我会将论文发送给您。
Does anyone know the Donald B. Johnson's algorithm, which enumerates all the elementary circuits (cycles) in a directed graph?
I have the paper he had published in 1975, but I cannot understand the pseudocode.
My goal is to implement this algorithm in Java.
Some questions I have, for example, is what is the matrix Ak it refers to. In the pseudocode, it mentions that
Ak:=adjacency structure of strong component K with least
vertex in subgraph of G induced by {s,s+1,....n};
Does that mean I have to implement another algorithm that finds the Ak matrix?
Another question is what the following means?
begin logical f;
Does also the line "logical procedure CIRCUIT (integer value v);"
mean that the circuit procedure returns a logical variable? In the pseudocode also has the line "CIRCUIT := f;
". What does this mean?
It would be great if someone could translate this 1970's pseudocode to a more modern type of pseudocode so I can understand it
In case you are interested to help but you cannot find the paper please email me at [email protected] and I will send you the paper.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
伪代码让人想起 Algol、Pascal 或 Ada。
Ak 似乎是具有指定属性的输入值数组的列表。它可能与相应的邻接矩阵有关,但我不清楚。我猜是这样的:
这声明了一个代表
true
或false
值的局部变量,类似于 Java 的boolean
。这声明了一个名为
CIRCUIT
的子程序,它具有按值传递的单个整数参数v
。子程序返回true
或false
的逻辑
结果,并且CIRCUIT := f
分配f< /code> 作为结果。在Java中,
关键字
begin
和end
界定了可以嵌套的块作用域,因此CIRCUIT
嵌套在主块中,UNBLOCK
嵌套在CIRCUIT
内部。:=
是赋值;Ø
是不是
;ε
是元素;∅
为空;≠
是!=
;stack
和unstack
建议push
和pop
。这只是一个开始,但我希望它有所帮助。
附录:根据反思,
A
和B
必须是同构的。这是一个非常字面的大纲。我对
A
、B
和A
的了解还不够。V
选择比数组更好的数据结构。The pseudo-code is reminiscent of Algol, Pascal or Ada.
Ak appears to be a list of arrays of input values having the specified properties. It may be related to the corresponding adjacency matrix, but it's not clear to me. I'm guessing something like this:
This declares a local variable representing a
true
orfalse
value, similar to Java'sboolean
.This declares a subprogram named
CIRCUIT
having a single integer parameterv
that is passed by value. The subprogram returns alogical
result oftrue
orfalse
, andCIRCUIT := f
assignsf
as the result. In Java,The keywords
begin
andend
delimit a block scope that may be nested, soCIRCUIT
is nested in the main block andUNBLOCK
is nested inside ofCIRCUIT
.:=
is assignment;¬
isnot
;∈
is element;∅
is empty;≠
is!=
;stack
andunstack
suggestpush
andpop
.It's only a start, but I hope it helps.
Addendum: On reflection,
A
andB
must be isomorphic.Here's a very literal outline. I don't know enough about
A
,B
&V
to choose a better data structure than arrays.您可以在 github 上找到该算法的 Java 实现:https://github.com/1123/johnson 。它使用 Jung2 java 图形库。
You can find a Java implementation of this algorithm on github: https://github.com/1123/johnson. It uses the Jung2 java graph library.