Changeset 7804:b0806f58981d
- Timestamp:
- 12/17/07 18:18:04 (5 years ago)
- Branch:
- default
- File:
-
- 1 edited
-
sage/graphs/graph.py (modified) (3 diffs)
Legend:
- Unmodified
- Added
- Removed
-
sage/graphs/graph.py
r7803 r7804 4099 4099 sage: P = graphs.PetersenGraph() 4100 4100 sage: P.spectrum() 4101 [-2.0, -2.0, -2.0, -2.0, 1.0, 1.0, 1.0, 1.0, 1.0, 3.0]4101 [-2.0, -2.0, -2.0, -2.0, 1.0, 1.0, 1.0, 1.0, 1.0, 3.0] 4102 4102 sage: P.spectrum(laplacian=True) # random low-order bits (at least for first eigenvalue) 4103 [-1.41325497305e-16, 2.0, 2.0, 2.0, 2.0, 2.0, 5.0, 5.0, 5.0, 5.0]4103 [-1.41325497305e-16, 2.0, 2.0, 2.0, 2.0, 2.0, 5.0, 5.0, 5.0, 5.0] 4104 4104 4105 4105 """ … … 4113 4113 E = M.right_eigenvectors()[0] 4114 4114 v = [e.real() for e in E] 4115 v.sort() 4116 return v 4115 v.sort() 4116 return v 4117 4118 def eigenspaces(self, laplacian=False): 4119 """ 4120 Returns the eigenspaces of the adjacency matrix of the graph. 4121 4122 EXAMPLE: 4123 sage: C = graphs.CycleGraph(5) 4124 sage: E = C.eigenspaces() 4125 sage: E[0][0] 4126 -1.61803398875 4127 sage: E[1][0] 4128 Vector space of degree 5 and dimension 1 over Real Double Field 4129 User basis matrix: 4130 [ 0.632455532034 -0.632455532034 -0.4472135955 -0.013900198608 0.0738411279702] 4131 4132 """ 4133 if laplacian: 4134 M = self.kirchhoff_matrix() 4135 else: 4136 M = self.am() 4137 from sage.matrix.constructor import matrix 4138 from sage.rings.real_double import RDF 4139 M = matrix(RDF, M.rows()) 4140 return M.eigenspaces() 4117 4141 4118 4142 ### Representations … … 4778 4802 NXG.delete_edges_from(edges_to_delete) 4779 4803 4780 if inplace:4804 if inplace: 4781 4805 self._nxg = NXG 4782 4806 else:
Note: See TracChangeset
for help on using the changeset viewer.
