Compare commits
No commits in common. "3338b255a11c34ac79ebc8bf9f79610c9e4db15b" and "f41ec73a056da22fa414383f1ed14a71059f27a1" have entirely different histories.
3338b255a1
...
f41ec73a05
@ -1,46 +0,0 @@
|
|||||||
#!/usr/bin/env python3
|
|
||||||
# -*- coding: utf-8 -*-
|
|
||||||
|
|
||||||
# ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
|
|
||||||
# IMPORTS
|
|
||||||
# ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
|
|
||||||
|
|
||||||
#
|
|
||||||
|
|
||||||
# ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
|
|
||||||
# EXPORTS
|
|
||||||
# ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
|
|
||||||
|
|
||||||
__all__ = [
|
|
||||||
'Graph',
|
|
||||||
];
|
|
||||||
|
|
||||||
# ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
|
|
||||||
# CLASS Graph
|
|
||||||
# ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
|
|
||||||
|
|
||||||
class Graph(object):
|
|
||||||
'''
|
|
||||||
a data structure for graphs
|
|
||||||
'''
|
|
||||||
nodes: list[str];
|
|
||||||
edges: list[tuple[str,str]]
|
|
||||||
|
|
||||||
def __init__(self, nodes: list[str], edges: list[tuple[str,str]]):
|
|
||||||
self.nodes = nodes;
|
|
||||||
self.edges = edges;
|
|
||||||
return;
|
|
||||||
|
|
||||||
def successor(self, u: str):
|
|
||||||
'''
|
|
||||||
@returns
|
|
||||||
list of successor nodes
|
|
||||||
'''
|
|
||||||
return [ v for (u_, v) in self.edges if u == u_ ];
|
|
||||||
|
|
||||||
def predecessor(self, v: str):
|
|
||||||
'''
|
|
||||||
@returns
|
|
||||||
list of predecessor nodes
|
|
||||||
'''
|
|
||||||
return [ u for (u, v_) in self.edges if v == v_ ];
|
|
@ -1,91 +0,0 @@
|
|||||||
#!/usr/bin/env python3
|
|
||||||
# -*- coding: utf-8 -*-
|
|
||||||
|
|
||||||
# ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
|
|
||||||
# IMPORTS
|
|
||||||
# ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
|
|
||||||
|
|
||||||
from enum import Enum;
|
|
||||||
|
|
||||||
from src.local.typing import *;
|
|
||||||
|
|
||||||
from src.stacks.stack import *;
|
|
||||||
from src.graphs.graph import *
|
|
||||||
|
|
||||||
# ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
|
|
||||||
# EXPORTS
|
|
||||||
# ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
|
|
||||||
|
|
||||||
__all__ = [
|
|
||||||
'tarjan_algorithm',
|
|
||||||
];
|
|
||||||
|
|
||||||
# ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
|
|
||||||
# CONSTANTS
|
|
||||||
# ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
|
|
||||||
|
|
||||||
class State(Enum):
|
|
||||||
UNTOUCHED = 0;
|
|
||||||
PENDING = 1;
|
|
||||||
FINISHED = 2;
|
|
||||||
|
|
||||||
# ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
|
|
||||||
# Tarjan Algorithm
|
|
||||||
# ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
|
|
||||||
|
|
||||||
class NodeInformation:
|
|
||||||
root: int;
|
|
||||||
index: int;
|
|
||||||
state: State;
|
|
||||||
|
|
||||||
def __init__(self):
|
|
||||||
self.root = self.index = 0;
|
|
||||||
self.state = State.UNTOUCHED;
|
|
||||||
|
|
||||||
def tarjan_algorithm(G: Graph) -> List[Any]:
|
|
||||||
'''
|
|
||||||
runs the Tarjan-Algorithm to compute the strongly connected components
|
|
||||||
'''
|
|
||||||
|
|
||||||
# sonst Stack erstellen und Bearbeitungszustand der Knoten im Speicher notieren:
|
|
||||||
S = Stack();
|
|
||||||
index = 0;
|
|
||||||
infos = { u: NodeInformation() for u in G.nodes };
|
|
||||||
components = [];
|
|
||||||
|
|
||||||
def tarjan_visit(v: Any):
|
|
||||||
'''
|
|
||||||
recursive depth-first search algorithm to compute components
|
|
||||||
'''
|
|
||||||
nonlocal G, S, index, components;
|
|
||||||
|
|
||||||
if not(infos[v].state == State.UNTOUCHED):
|
|
||||||
return;
|
|
||||||
|
|
||||||
index += 1;
|
|
||||||
infos[v].index = infos[v].root = index;
|
|
||||||
S.push(v);
|
|
||||||
|
|
||||||
infos[v].state = State.PENDING;
|
|
||||||
# depth first search:
|
|
||||||
for u in G.successor(v):
|
|
||||||
tarjan_visit(u);
|
|
||||||
# remains relevant for v, provided u still in Stack:
|
|
||||||
if u in S:
|
|
||||||
infos[v].root = min(infos[v].root, infos[u].root);
|
|
||||||
infos[v].state = State.FINISHED;
|
|
||||||
|
|
||||||
# if at root of component pop everything from stack up to root and add component:
|
|
||||||
if infos[v].index == infos[v].root:
|
|
||||||
component = [];
|
|
||||||
condition_reached_root = False;
|
|
||||||
while not condition_reached_root:
|
|
||||||
u = S.pop();
|
|
||||||
component.append(u);
|
|
||||||
condition_reached_root = (u == v);
|
|
||||||
components.append(component);
|
|
||||||
return;
|
|
||||||
|
|
||||||
for v in G.nodes:
|
|
||||||
tarjan_visit(v);
|
|
||||||
return components;
|
|
@ -1,24 +0,0 @@
|
|||||||
#!/usr/bin/env python3
|
|
||||||
# -*- coding: utf-8 -*-
|
|
||||||
|
|
||||||
# ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
|
|
||||||
# IMPORTS
|
|
||||||
# ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
|
|
||||||
|
|
||||||
import json;
|
|
||||||
from yaml import add_constructor;
|
|
||||||
from yaml import load;
|
|
||||||
from yaml import Loader;
|
|
||||||
from yaml import FullLoader;
|
|
||||||
|
|
||||||
# ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
|
|
||||||
# EXPORTS
|
|
||||||
# ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
|
|
||||||
|
|
||||||
__all__ = [
|
|
||||||
'json',
|
|
||||||
'add_constructor',
|
|
||||||
'load',
|
|
||||||
'Loader',
|
|
||||||
'FullLoader',
|
|
||||||
];
|
|
@ -1,20 +0,0 @@
|
|||||||
#!/usr/bin/env python3
|
|
||||||
# -*- coding: utf-8 -*-
|
|
||||||
|
|
||||||
# ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
|
|
||||||
# IMPORTS
|
|
||||||
# ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
|
|
||||||
|
|
||||||
import io;
|
|
||||||
import getpass;
|
|
||||||
import argparse;
|
|
||||||
|
|
||||||
# ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
|
|
||||||
# EXPORTS
|
|
||||||
# ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
|
|
||||||
|
|
||||||
__all__ = [
|
|
||||||
'io',
|
|
||||||
'getpass',
|
|
||||||
'argparse',
|
|
||||||
];
|
|
@ -1,18 +0,0 @@
|
|||||||
#!/usr/bin/env python3
|
|
||||||
# -*- coding: utf-8 -*-
|
|
||||||
|
|
||||||
# ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
|
|
||||||
# IMPORTS
|
|
||||||
# ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
|
|
||||||
|
|
||||||
import math;
|
|
||||||
import random;
|
|
||||||
|
|
||||||
# ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
|
|
||||||
# EXPORTS
|
|
||||||
# ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
|
|
||||||
|
|
||||||
__all__ = [
|
|
||||||
'math',
|
|
||||||
'random',
|
|
||||||
];
|
|
@ -1,18 +0,0 @@
|
|||||||
#!/usr/bin/env python3
|
|
||||||
# -*- coding: utf-8 -*-
|
|
||||||
|
|
||||||
# ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
|
|
||||||
# IMPORTS
|
|
||||||
# ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
|
|
||||||
|
|
||||||
import re;
|
|
||||||
from textwrap import dedent;
|
|
||||||
|
|
||||||
# ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
|
|
||||||
# EXPORTS
|
|
||||||
# ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
|
|
||||||
|
|
||||||
__all__ = [
|
|
||||||
're',
|
|
||||||
'dedent',
|
|
||||||
];
|
|
@ -1,23 +0,0 @@
|
|||||||
#!/usr/bin/env python3
|
|
||||||
# -*- coding: utf-8 -*-
|
|
||||||
|
|
||||||
# ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
|
|
||||||
# IMPORTS
|
|
||||||
# ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
|
|
||||||
|
|
||||||
import os;
|
|
||||||
import sys;
|
|
||||||
|
|
||||||
import platform;
|
|
||||||
import shutil;
|
|
||||||
|
|
||||||
# ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
|
|
||||||
# EXPORTS
|
|
||||||
# ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
|
|
||||||
|
|
||||||
__all__ = [
|
|
||||||
'os',
|
|
||||||
'sys',
|
|
||||||
'platform',
|
|
||||||
'shutil',
|
|
||||||
];
|
|
@ -1,37 +0,0 @@
|
|||||||
#!/usr/bin/env python3
|
|
||||||
# -*- coding: utf-8 -*-
|
|
||||||
|
|
||||||
# ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
|
|
||||||
# IMPORTS
|
|
||||||
# ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
|
|
||||||
|
|
||||||
from types import TracebackType;
|
|
||||||
|
|
||||||
from typing import Any;
|
|
||||||
from typing import Callable;
|
|
||||||
from typing import Dict;
|
|
||||||
from typing import Generator;
|
|
||||||
from typing import Generic;
|
|
||||||
from typing import List;
|
|
||||||
from typing import Tuple;
|
|
||||||
from typing import Type;
|
|
||||||
from typing import TypeVar;
|
|
||||||
from typing import Union;
|
|
||||||
|
|
||||||
# ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
|
|
||||||
# EXPORTS
|
|
||||||
# ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
|
|
||||||
|
|
||||||
__all__ = [
|
|
||||||
'TracebackType',
|
|
||||||
'Any',
|
|
||||||
'Callable',
|
|
||||||
'Dict',
|
|
||||||
'Generator',
|
|
||||||
'Generic',
|
|
||||||
'List',
|
|
||||||
'Tuple',
|
|
||||||
'Type',
|
|
||||||
'TypeVar',
|
|
||||||
'Union',
|
|
||||||
];
|
|
@ -11,9 +11,6 @@ import sys;
|
|||||||
os.chdir(os.path.join(os.path.dirname(__file__), '..'));
|
os.chdir(os.path.join(os.path.dirname(__file__), '..'));
|
||||||
sys.path.insert(0, os.getcwd());
|
sys.path.insert(0, os.getcwd());
|
||||||
|
|
||||||
from src.graphs.graph import *;
|
|
||||||
from src.graphs.tarjan import *;
|
|
||||||
|
|
||||||
# ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
|
# ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
|
||||||
# GLOBAL CONSTANTS/VARIABLES
|
# GLOBAL CONSTANTS/VARIABLES
|
||||||
# ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
|
# ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
|
||||||
@ -25,15 +22,7 @@ from src.graphs.tarjan import *;
|
|||||||
# ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
|
# ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
|
||||||
|
|
||||||
def enter():
|
def enter():
|
||||||
## Beispiel aus Seminarblatt 1
|
print('Hello world!')
|
||||||
## TODO -> schieben in config datei
|
|
||||||
G = Graph(
|
|
||||||
nodes=[1,2,3,4,5,6,7],
|
|
||||||
edges=[(1,2), (1,3), (2,3), (3,4), (4,5), (5,2), (5,6), (5,7), (6,7)],
|
|
||||||
);
|
|
||||||
components = tarjan_algorithm(G);
|
|
||||||
for component in components:
|
|
||||||
print(component);
|
|
||||||
return;
|
return;
|
||||||
|
|
||||||
# ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
|
# ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
|
||||||
|
@ -1,64 +0,0 @@
|
|||||||
#!/usr/bin/env python3
|
|
||||||
# -*- coding: utf-8 -*-
|
|
||||||
|
|
||||||
# ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
|
|
||||||
# IMPORTS
|
|
||||||
# ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
|
|
||||||
|
|
||||||
from src.local.typing import *;
|
|
||||||
|
|
||||||
# ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
|
|
||||||
# EXPORTS
|
|
||||||
# ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
|
|
||||||
|
|
||||||
__all__ = [
|
|
||||||
'Stack',
|
|
||||||
];
|
|
||||||
|
|
||||||
# ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
|
|
||||||
# CLASS Stack
|
|
||||||
# ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
|
|
||||||
|
|
||||||
class Stack:
|
|
||||||
'''
|
|
||||||
A data structure for stacks
|
|
||||||
'''
|
|
||||||
values: list[Any];
|
|
||||||
|
|
||||||
def __init__(self):
|
|
||||||
self.values = [];
|
|
||||||
return;
|
|
||||||
|
|
||||||
def __len__(self):
|
|
||||||
'''
|
|
||||||
@returns
|
|
||||||
number of elements in stack
|
|
||||||
'''
|
|
||||||
return len(self.values);
|
|
||||||
|
|
||||||
def __contains__(self, value: Any) -> bool:
|
|
||||||
return value in self.values;
|
|
||||||
|
|
||||||
def push(self, value: Any):
|
|
||||||
'''
|
|
||||||
add element to stack
|
|
||||||
'''
|
|
||||||
self.values.append(value);
|
|
||||||
|
|
||||||
def pop(self) -> Any:
|
|
||||||
'''
|
|
||||||
@returns
|
|
||||||
top element from stack and removes it
|
|
||||||
'''
|
|
||||||
value = self.top();
|
|
||||||
self.values = self.values[:-1];
|
|
||||||
return value;
|
|
||||||
|
|
||||||
def top(self) -> Any:
|
|
||||||
'''
|
|
||||||
@returns
|
|
||||||
top element from stack without removal
|
|
||||||
'''
|
|
||||||
if len(self.values) == 0:
|
|
||||||
raise Exception('Stack is empty!');
|
|
||||||
return self.values[-1];
|
|
@ -2,24 +2,13 @@
|
|||||||
|
|
||||||
## Agenda ##
|
## Agenda ##
|
||||||
|
|
||||||
- [x] Orga
|
- [ ] Orga:
|
||||||
- Ziel von Seminaren vs. Übung
|
- [ ] Themen:
|
||||||
- Repo
|
|
||||||
- [x] Themen:
|
## Nächste Woche ##
|
||||||
- Einige (nicht alle) Begriffe über Graphen
|
|
||||||
- Weg vs. Pfad vs. Zyklus
|
-
|
||||||
- Zusammenhang:
|
|
||||||
- (schwach) zusammenhängend ⟺ ∀u,v ∈ V(G): ∃ Weg von entweder u nach v ODER v nach u
|
|
||||||
- **stark** zusammenhängend ⟺ ∀u,v ∈ V(G): ∃ Weg von u nach v
|
|
||||||
</br>
|
|
||||||
⟺ ∀u,v ∈ V(G): ∃ Weg von sowohl u nach v UND v nach u
|
|
||||||
- Für unger. Gph: zshgd ⟺ stark zshgd. Aber nicht für ger. Gph.
|
|
||||||
- induzierter Teilgraph
|
|
||||||
- stark zshgd Komponente
|
|
||||||
- Konstruktion
|
|
||||||
- maximale Komponenten
|
|
||||||
|
|
||||||
### TODOs (Studierende) ###
|
### TODOs (Studierende) ###
|
||||||
|
|
||||||
- Begriffe aus VL1 **sorgfältig** (siehe Anmerkung im Skript!) aufschreiben, verinnerlichen, sich damit vertraut machen.
|
-
|
||||||
- abzugebende Übungsblätter zu Ende machen.
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user