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 d6f1172

Browse files
Three Hundred - Thirty-Four Commit: Implement outdegree() function
1 parent c147003 commit d6f1172

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
@@ -80,4 +80,11 @@ def edges_print(self):
8080
for i in range(self._vertices):
8181
for j in range(self._vertices):
8282
if self._adjacent_matrix[i][j] != 0:
83-
print(i, '--', j)
83+
print(i, '--', j)
84+
85+
def outdegree(self, v):
86+
count = 0
87+
for j in range(self._vertices):
88+
if self._adjacent_matrix[v][j] != 0:
89+
count = count + 1
90+
return count

0 commit comments

Comments
(0)

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