{"action":"created","issue":{"url":"https://api.github.com/repos/networkx/networkx/issues/1946","labels_url":"https://api.github.com/repos/networkx/networkx/issues/1946/labels{/name}","comments_url":"https://api.github.com/repos/networkx/networkx/issues/1946/comments","events_url":"https://api.github.com/repos/networkx/networkx/issues/1946/events","html_url":"https://github.com/networkx/networkx/issues/1946","id":127182106,"number":1946,"title":"Feature request: edge coloring, and color-specific paths and iterators","user":{"login":"borisdan","id":5167646,"avatar_url":"https://avatars.githubusercontent.com/u/5167646?v=3","gravatar_id":"","url":"https://api.github.com/users/borisdan","html_url":"https://github.com/borisdan","followers_url":"https://api.github.com/users/borisdan/followers","following_url":"https://api.github.com/users/borisdan/following{/other_user}","gists_url":"https://api.github.com/users/borisdan/gists{/gist_id}","starred_url":"https://api.github.com/users/borisdan/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/borisdan/subscriptions","organizations_url":"https://api.github.com/users/borisdan/orgs","repos_url":"https://api.github.com/users/borisdan/repos","events_url":"https://api.github.com/users/borisdan/events{/privacy}","received_events_url":"https://api.github.com/users/borisdan/received_events","type":"User","site_admin":false},"labels":[],"state":"open","locked":false,"assignee":null,"milestone":null,"comments":5,"created_at":"2016-01-18T09:05:45Z","updated_at":"2016-01-20T20:19:55Z","closed_at":null,"body":"I realize edge colors can be set using attributes, but I think this particular property is more interesting, and should have more capabilities.\r\n1. Add a color parameter to the *edges*, *edges_iter* functions, which gives all edges of a particular kind.\r\n2. Find a shortest path out of edges of a specific color. Again, this can be done by having a different weight attribute per edge-type, but then each edge needs to have all other possible weight attribute type set to *float('inf')*."},"comment":{"url":"https://api.github.com/repos/networkx/networkx/issues/comments/173348030","html_url":"https://github.com/networkx/networkx/issues/1946#issuecomment-173348030","issue_url":"https://api.github.com/repos/networkx/networkx/issues/1946","id":173348030,"user":{"login":"dschult","id":915037,"avatar_url":"https://avatars.githubusercontent.com/u/915037?v=3","gravatar_id":"","url":"https://api.github.com/users/dschult","html_url":"https://github.com/dschult","followers_url":"https://api.github.com/users/dschult/followers","following_url":"https://api.github.com/users/dschult/following{/other_user}","gists_url":"https://api.github.com/users/dschult/gists{/gist_id}","starred_url":"https://api.github.com/users/dschult/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/dschult/subscriptions","organizations_url":"https://api.github.com/users/dschult/orgs","repos_url":"https://api.github.com/users/dschult/repos","events_url":"https://api.github.com/users/dschult/events{/privacy}","received_events_url":"https://api.github.com/users/dschult/received_events","type":"User","site_admin":false},"created_at":"2016-01-20T20:19:55Z","updated_at":"2016-01-20T20:19:55Z","body":"In the meantime, you can use:\r\n\r\n    H = nx.Graph((u, v) for u, v, d in G.edges(data='color') if d == 'red')\r\n    H.add_nodes_from([x, y]) # in case x or y has no red edge\r\n    nx.shortest_path(H, x, y)"}}