Opened 10 years ago

Closed 4 years ago

#10507 closed defect (wontfix)

In Generic graphs, adjacency matrices with non-negative non-integral entries are treated as "multi-edge" instead of "weighted"

Reported by: xqwang Owned by: xqwang
Priority: minor Milestone: sage-duplicate/invalid/wontfix
Component: graph theory Keywords: weighted adjacency matrix
Cc: tscrim Merged in:
Authors: Reviewers: Frédéric Chapoton
Report Upstream: N/A Work issues:
Branch: Commit:
Dependencies: Stopgaps:

Description

Let M be a symmetric, non-negative, and non-integral valued matrix. The Graph Theory module (graph.py) treats is as the adjacency matrix of a multi-edge graph, which does not make sense. It is more reasonable and intuitive to treat is as the adjacency matrix of a weight graph.

This defect is observed in Sage 4.4.1 and Sage 4.6

sage: M = Matrix([[0,1,1],[1,0,1/2],[1,1/2,0]]); M    
[  0   1   1]
[  1   0 1/2]
[  1 1/2   0]
sage: Graph(M)
Multi-graph on 3 vertices

Change History (4)

comment:1 Changed 10 years ago by xqwang

  • Owner changed from jason, ncohen, rlm to xqwang

This defect can be fixed by changing the following two lines of code in $SAGE_HOME/local/lib/python/site-packages/sage/graphs/graph.py

918 e = int(e)

919 assert e >= 0

TO

918 e_flr = int(e)

919 assert (e_flr >= 0 and e_flr == e)

This change will make sure that if the adjacency matrix is non-integral then its entries are treated as weights (in stead of # of edges).

comment:2 Changed 5 years ago by jmantysalo

  • Cc tscrim added
  • Milestone set to sage-duplicate/invalid/wontfix
  • Status changed from new to needs_review

This has been corrected at some point. Travis, can you confirm and put to positive_review.

comment:3 Changed 5 years ago by chapoton

  • Authors xqwang deleted
  • Reviewers set to Frédéric Chapoton
  • Status changed from needs_review to positive_review

ok, seems to work smoothly

comment:4 Changed 4 years ago by embray

  • Resolution set to wontfix
  • Status changed from positive_review to closed

Determined to be invalid/duplicate/wontfix (closing as "wontfix" as a catch-all resolution).

Note: See TracTickets for help on using tickets.