Jump to content

Whats the return value

HeaterUp

So I have a graph made using map<string(node), map<string(node2), int(weight)>> graph; Using this graph I need to apply a DFS and BFS but the only trouble im having is finding the adjacent nodes without creating an adjancy matrix. Is it possible to do this by just using something like graph[node]; Or what is the return value from graph[node] sense it is another map of node2 along with the weight.

Link to comment
Share on other sites

Link to post
Share on other sites

1 hour ago, Erik Sieghart said:

What language are you using?

Looks to me like @HeaterUp is using C# but this is only a speculation.

 

edit: Since this thread is tagged with C++ I think it's safe to say C++ is the language.

import { signature } from "./signature";

signature.display({ cpu"Intel i9 9900k @ 3.56HZ",  gpu"ASUS GTX 1080",  ram"32GB CORSAIR DDR4", motherboard"ASUS Z390-E" });

 

Link to comment
Share on other sites

Link to post
Share on other sites

graph[node] returns a std::map<string, int>&

which you can loop over to add the nodes to your DFS/BFS stack/queue/whatever.

1474412270.2748842

Link to comment
Share on other sites

Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now

×