Graph 从Alloy 4.2中的图形创建独立集

Graph 从Alloy 4.2中的图形创建独立集,graph,alloy,independent-set,Graph,Alloy,Independent Set,我创建了一个测试图,试图从中创建一个独立的集合。我知道独立集是一组没有连接的顶点,但我不确定如何在alloy 4.2中实现这一点。以下是我所拥有的: abstract sig Vertex { e: set Vertex -- e is the edge relation } -- the test graph has vertices A, B, C, D, E, F one sig A, B, C, D, E, F extends Vertex { } pred independ

我创建了一个测试图,试图从中创建一个独立的集合。我知道独立集是一组没有连接的顶点,但我不确定如何在alloy 4.2中实现这一点。以下是我所拥有的:

abstract sig Vertex {
    e: set Vertex   -- e is the edge relation
}
-- the test graph has vertices A, B, C, D, E, F
one sig A, B, C, D, E, F extends Vertex { }
pred independentSet[e: Vertex->Vertex, s: set Vertex] {
    --code here?
}
pred show {
    -- setting up the edge relation
    (A->A + A->B + A->C + A->D) +
        (B->A + B->B + B->C + B->E) +
            (C->A + C->B + C->C + C->F) = e
}
run show for 6

这就是我给出的答案,我认为这是正确的,并给出了一个例子。我认为它遗漏了一点,但不确定如何充分表达它。我希望它能给你一个想法

无e
较短。(但是太短了,没有注释,所以这是一个填充词。)

你是说
没有e&s->s
all i, j: s | not i -> j in e