Skip to content

Instantly share code, notes, and snippets.

@vermiculus
Created April 2, 2014 00:32
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save vermiculus/9925840 to your computer and use it in GitHub Desktop.
Save vermiculus/9925840 to your computer and use it in GitHub Desktop.
--- !Move
name: mark node
description: mark this node
author: Sean Allred
date: 2014-05-17
tex: '"marked"(n) = 1'
filename: mark.py
--- !Move
name: unmark node
description: unmark this node
author: Sean Allred
date: 2014-05-17
tex: '"marked"(n) = 0'
filename: unmark.py
--- !Predicate
name: marked and neighbor marked
filename: marked-and-neighbor-marked.py
description: two adjacent nodes are marked
author: Sean Allred
date: 2014-05-17
tex: '"marked"(n) = 1 \land \exists v \in N(n) : "marked"(v) = 1'
--- !Predicate
name: unmarked and neighbors unmarked
filename: unmarked-and-neighbors-unmarked.py
description: All nodes in N[n] are unmarked
author: Sean Allred
date: 2014-05-17
tex: '"marked"(n) = 0 \land \forall v \in N(n) : "marked"(v) = 0'
--- !Algorithm
name: Independent Set
author: Sean Allred
date: 2014-05-17
rules:
- !Rule
description: if a neighbor is marked, unmark
author: Sean Allred
date: 2014-05-17
predicate: marked and neighbor marked
moves: [ unmark node ]
- !Rule
description: if no neighbors are marked, mark
author: Sean Allred
date: 2014-05-17
predicate: unmarked and neighbors unmarked
moves: [ mark node ]
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment