Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Commit 5656b61

Browse files
Three Hundred - Thirty-Five Commit: Implement indegree() function
1 parent d6f1172 commit 5656b61

File tree

1 file changed

+8
-1
lines changed

1 file changed

+8
-1
lines changed

‎Section_12(Graphs)/(1)_graph.py

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -87,4 +87,11 @@ def outdegree(self, v):
8787
for j in range(self._vertices):
8888
if self._adjacent_matrix[v][j] != 0:
8989
count = count + 1
90-
return count
90+
return count
91+
92+
def indegree(self, v):
93+
count = 0
94+
for i in range(self._vertices):
95+
if self._adjacent_matrix[i][v] != 0:
96+
count = count + 1
97+
return count

0 commit comments

Comments
(0)

AltStyle によって変換されたページ (->オリジナル) /