2.7.3 Matrix from Object

Provide a _matrix_ member function for an object that can be coerced to a matrix over a ring $ R$ . Then the Sage function matrix will work for this object.

The following is from SAGE_ROOT/devel/sage/sage/graphs/graph.py

class SimpleGraph(GenericGraph):
   ...
   def _matrix_(self, R):
       return self.am()

   def am(self):
       """
       Shorter call for adjacency matrix makes life easier.
       """
       return self.adjacency_matrix()

See About this document... for information on suggesting changes.