Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- public HashMap<Vertex, Integer> Indegree ( ) {
- HashMap <Vertex, Integer> degrees = new HashMap <Vertex, Integer> ( );
- for ( Vertex v : this.adjacencyMap.keySet() )
- degrees.put( v, 0 );
- for ( Vertex v : this.adjacencyMap.keySet() )
- for ( Vertex inV : this.adjacencyMap.get( v ).keySet() )
- degrees.put( inV , degrees.get(inV) + 1 );
- return degrees;
- }
- public HashMap<Vertex, Integer> Outdegree ( ) {
- HashMap<Vertex, Integer> outDegrees = new HashMap<Vertex, Integer>( );
- for ( Vertex v : this.adjacencyMap.keySet() )
- outDegrees.put( v, this.adjacencyMap.get(v).size() );
- return outDegrees;
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement