Changeset cc77af9 in tol
- Timestamp:
- Nov 13, 2009, 4:09:54 PM (17 years ago)
- Branches:
- 1941-docker-image-to-test, devel, master
- Children:
- 69fede85
- Parents:
- a392913
- File:
-
- 1 edited
-
tol_pkg/GraphTools/GraphTools.tol (modified) (5 diffs)
Legend:
- Unmodified
- Added
- Removed
-
tol_pkg/GraphTools/GraphTools.tol
ra392913 rcc77af9 9 9 ////////////////////////////////////////////////////////////////////////////// 10 10 [[ 11 #Require MatEncode;12 #Require MatQuery;11 #Require MatEncode; 12 #Require MatQuery; 13 13 14 14 Text _.autodoc.description = "Functions and classes related with Graph " … … 77 77 }); 78 78 Real _.vertex::add.feature.nonnumeric("Identifier", vertex.names); 79 Matrix _.vertex::_.data := DifEq(1/(1-B),Rand(_.vertex.num,1,1,1));79 VMatrix _.vertex::_.data := DifEq(1/(1-B),Rand(_.vertex.num,1,1,1)); 80 80 Real _.edge::add.feature.numeric("Output"); 81 81 Real _.edge::add.feature.numeric("Input"); … … 85 85 //////////////////////////////////////////////////////////////////////////// 86 86 Text _.autodoc.member.edge.build = ""; 87 Real edge.build( Matrix data, Real removeRepeatedEdges)88 //////////////////////////////////////////////////////////////////////////// 89 { 90 Real _.edge.num := Rows(data);91 Matrix out_ = SubCol(data,[[1]]);92 Matrix in_ = SubCol(data,[[2]]);93 Matrix out = If(_.directed, out_, Min(in_, out_));94 Matrix in = If(_.directed, in_, Max(in_, out_));95 Matrix _.edge::_.data := out | in | SubCol(data,Range(3,Columns(data),1));96 Matrix idx = DifEq(1/(1-B),Rand(_.edge.num,1,1,1));97 Matrix idx.rep = Rand(_.edge.num,1,1,1);98 Matrix outInRep = out|in|idx.rep;87 Real edge.build(VMatrix data, Real removeRepeatedEdges) 88 //////////////////////////////////////////////////////////////////////////// 89 { 90 Real _.edge.num := VRows(data); 91 VMatrix out_ = SubCol(data,[[1]]); 92 VMatrix in_ = SubCol(data,[[2]]); 93 VMatrix out = If(_.directed, out_, Min(in_, out_)); 94 VMatrix in = If(_.directed, in_, Max(in_, out_)); 95 VMatrix _.edge::_.data := out|in|SubCol(data,Range(3,VColumns(data),1)); 96 VMatrix idx = DifEq(1/(1-B),Rand(_.edge.num,1,1,1)); 97 VMatrix idx.rep = Rand(_.edge.num,1,1,1); 98 Matrix outInRep = VMat2Mat(out|in|idx.rep); 99 99 VMatrix triplet.rep = Triplet(outInRep,_.vertex.num,_.vertex.num); 100 100 VMatrix _.edge.repeated := Convert(triplet.rep,"Cholmod.R.Sparse"); … … 125 125 Triplet 126 126 }); 127 VMatrix triplet.map = funTriplet(out|in|idx,_.vertex.num,_.vertex.num); 127 VMatrix triplet.map = funTriplet( 128 VMat2Mat(out|in|idx),_.vertex.num,_.vertex.num); 128 129 VMatrix _.edge.map := Convert(triplet.map,"Cholmod.R.Sparse"); 129 VMatrix _.edge.map.t := Tra(_.edge.map);130 130 True 131 131 }; … … 265 265 guarda en un set. Sólo crea las que no existan aún. Sólo devuelve la del 266 266 orden solicitado. 267 Matrix get.adyacency(Real order)267 VMatrix get.adyacency(Real order) 268 268 //////////////////////////////////////////////////////////////////////////// 269 269
Note: See TracChangeset
for help on using the changeset viewer.
