Weighted directed graphs are not generated successfully

Asked 2 years ago, Updated 2 years ago, 113 views

I'm trying to generate a weighted network using Julia.
I tried to run it exactly as it says on this site, but some of it didn't work.It may be better to throw an issue, but I am used to it, so I asked you a question.

using June

g = Graph(2)
addedge!(g,1,2)#_____ So far, it works well

#g[1,2,:weight] = 3 #This is where the error occurs
plot(g)

Error

MethodError: no method matching setindex!(:Graph {UInt32, UInt32, Junet.Forward, Junet.Multi}, ::Int64, ::Int64, ::Int64, ::Symbol)
Closeest candidates are:
  setindex!(:Graph, ::Any, ::Integer, !Matched::Colon, ::Symbol) at C:\JuliaPkg\dev\Junet\src\graph_operations.jl:387
  setindex!(:Graph, ::Any, !Matched::Colon, ::Integer, ::Symbol) at C:\JuliaPkg\dev\Junet\src\graph_operations.jl:388
  setindex!(:Graph, ::Any, ::Any, !Matched::Symbol) at C:\JuliaPkg\dev\Junet\src\graph_operations.jl:380
  ...

Stacktrace:
 [1] top-level scope at In [31]: 8

It says that the number of elements in the contents is strange, but for your information, I understand that if you want to change the weight of the edges between specific nodes, g[1,2,:weight] = any weight, but it doesn't work.

I will post it as an information sharing

Note:
g[:,:weight] = 1.3 , where

2-element Junet.ConstantAttribute {Float64, 1, getfield(Junet, Symbol("##3#4")){Graph {UInt32, UInt32, Junet.Forward, Junet.Multi}}}:
 1.3
 1.3

and the node, not the edge between the and the two points.If g[1,2,:weight] = 1.3, an error will still occur.

network julia

2022-09-30 19:35

1 Answers

https://github.com/inguar/Junet.jl/blob/master/src/graph_operations.jl#L389
The method I'm trying to call is commented out, so I guess there's an error.
Looking back, the edgeids used in the implementation part are #FIXME, so I think that's what happened.


2022-09-30 19:35

If you have any answers or tips


© 2024 OneMinuteCode. All rights reserved.