some logic for graphs