Opened 8 years ago

Last modified 7 years ago

#14535 closed enhancement

Mutability of Graphs — at Initial Version

Reported by: SimonKing Owned by: jason, ncohen, rlm
Priority: major Milestone: sage-duplicate/invalid/wontfix
Component: graph theory Keywords: mutability graph
Cc: jernej Merged in:
Authors: Simon King Reviewers:
Report Upstream: N/A Work issues:
Branch: Commit:
Dependencies: #14524 Stopgaps:

Status badges


This patch allows to create immutable graphs, so that they can be used as keys in dictionaries.

Previously, calling hash on a graph did work after assigning the attribute _immutable to the graph. That's a hack, and it would in fact not prevent the graph from being mutated.

With this patch, the attempt to change an immutable graph be means of methods such as add_vertex or add_edge or delete_vertex, will result in an error. If one really wants to play nasty, one could make an immutable graph mutable and change it, or use the backend of the graph for changing the underlying data.

Change History (1)

Changed 8 years ago by SimonKing

Note: See TracTickets for help on using tickets.