2
0
Fork 0
mirror of https://github.com/MartinThoma/LaTeX-examples.git synced 2025-04-19 11:38:05 +02:00

(V, E) -> (E, K); added two examples; removed crap

This commit is contained in:
Martin Thoma 2013-04-22 09:36:59 +02:00
parent 71f296ac0b
commit 7253de8aba
11 changed files with 88 additions and 640 deletions

View file

@ -1,27 +0,0 @@
#inner-details {
font-size:12px;
}
span.close {
color:#FF5555;
cursor:pointer;
font-weight:bold;
margin-left:3px;
}
span.name {
cursor: pointer;
}
/*TOOLTIPS*/
.tip {
text-align: left;
width:auto;
max-width:500px;
}
.tip-title {
font-size: 11px;
text-align:center;
margin-bottom:2px;
}

View file

@ -1,123 +0,0 @@
html, body {
margin:0;
padding:0;
font-family: "Lucida Grande", Verdana;
font-size: 0.9em;
text-align: center;
background-color:#F2F2F2;
}
input, select {
font-size:0.9em;
}
table {
margin-top:-10px;
margin-left:7px;
}
h4 {
font-size:1.1em;
text-decoration:none;
font-weight:normal;
color:#23A4FF;
}
a {
color:#23A4FF;
}
#container {
width: 1000px;
height: 600px;
margin:0 auto;
position:relative;
}
#left-container,
#right-container,
#center-container {
height:600px;
position:absolute;
top:0;
}
#left-container, #right-container {
width:200px;
color:#686c70;
text-align: left;
overflow: auto;
background-color:#fff;
background-repeat:no-repeat;
border-bottom:1px solid #ddd;
}
#left-container {
left:0;
background-image:url('col2.png');
background-position:center right;
border-left:1px solid #ddd;
}
#right-container {
right:0;
background-image:url('col1.png');
background-position:center left;
border-right:1px solid #ddd;
}
#right-container h4{
text-indent:8px;
}
#center-container {
width:600px;
left:200px;
background-color:#1a1a1a;
color:#ccc;
}
.text {
margin: 7px;
}
#inner-details {
font-size:0.8em;
list-style:none;
margin:7px;
}
#log {
position:absolute;
top:10px;
font-size:1.0em;
font-weight:bold;
color:#23A4FF;
}
#infovis {
position:relative;
width:600px;
height:600px;
margin:auto;
overflow:hidden;
}
/*TOOLTIPS*/
.tip {
color: #111;
width: 139px;
background-color: white;
border:1px solid #ccc;
-moz-box-shadow:#555 2px 2px 8px;
-webkit-box-shadow:#555 2px 2px 8px;
-o-box-shadow:#555 2px 2px 8px;
box-shadow:#555 2px 2px 8px;
opacity:0.9;
filter:alpha(opacity=90);
font-size:10px;
font-family:Verdana, Geneva, Arial, Helvetica, sans-serif;
padding:7px;
}

View file

@ -1,458 +0,0 @@
var labelType, useGradients, nativeTextSupport, animate;
(function() {
var ua = navigator.userAgent,
iStuff = ua.match(/iPhone/i) || ua.match(/iPad/i),
typeOfCanvas = typeof HTMLCanvasElement,
nativeCanvasSupport = (typeOfCanvas == 'object' || typeOfCanvas == 'function'),
textSupport = nativeCanvasSupport
&& (typeof document.createElement('canvas').getContext('2d').fillText == 'function');
//I'm setting this based on the fact that ExCanvas provides text support for IE
//and that as of today iPhone/iPad current text support is lame
labelType = (!nativeCanvasSupport || (textSupport && !iStuff))? 'Native' : 'HTML';
nativeTextSupport = labelType == 'Native';
useGradients = nativeCanvasSupport;
animate = !(iStuff || !nativeCanvasSupport);
})();
var Log = {
elem: false,
write: function(text){
if (!this.elem)
this.elem = document.getElementById('log');
this.elem.innerHTML = text;
this.elem.style.left = (500 - this.elem.offsetWidth / 2) + 'px';
}
};
function init(){
// init data
var json = [
{
"adjacencies": [
"graphnode0",
{
"nodeTo": "graphnode1",
"nodeFrom": "graphnode0",
"data": {
"$color": "#557EAA"
}
}, {
"nodeTo": "graphnode5",
"nodeFrom": "graphnode0",
"data": {
"$color": "#909291"
}
}, {
"nodeTo": "graphnode9",
"nodeFrom": "graphnode0",
"data": {
"$color": "#557EAA"
}
}
],
"data": {
"$color": "#83548B",
"$type": "circle",
"$dim": 8
},
"id": "graphnode0",
"name": "graphnode0"
}, {
"adjacencies": [
"graphnode1",
{
"nodeTo": "graphnode8",
"nodeFrom": "graphnode1",
"data": {
"$color": "#557EAA"
}
}, {
"nodeTo": "graphnode0",
"nodeFrom": "graphnode1",
"data": {
"$color": "#909291"
}
}, {
"nodeTo": "graphnode2",
"nodeFrom": "graphnode1",
"data": {
"$color": "#557EAA"
}
}
],
"data": {
"$color": "#83548B",
"$type": "circle",
"$dim": 8
},
"id": "graphnode1",
"name": "graphnode1"
}, {
"adjacencies": [
"graphnode2",
{
"nodeTo": "graphnode1",
"nodeFrom": "graphnode2",
"data": {
"$color": "#557EAA"
}
}, {
"nodeTo": "graphnode3",
"nodeFrom": "graphnode2",
"data": {
"$color": "#909291"
}
}, {
"nodeTo": "graphnode6",
"nodeFrom": "graphnode2",
"data": {
"$color": "#557EAA"
}
}
],
"data": {
"$color": "#83548B",
"$type": "circle",
"$dim": 8
},
"id": "graphnode2",
"name": "graphnode2"
}, {
"adjacencies": [
"graphnode3",
{
"nodeTo": "graphnode2",
"nodeFrom": "graphnode3",
"data": {
"$color": "#557EAA"
}
}, {
"nodeTo": "graphnode4",
"nodeFrom": "graphnode3",
"data": {
"$color": "#909291"
}
}, {
"nodeTo": "graphnode9",
"nodeFrom": "graphnode3",
"data": {
"$color": "#557EAA"
}
}
],
"data": {
"$color": "#83548B",
"$type": "circle",
"$dim": 8
},
"id": "graphnode3",
"name": "graphnode3"
}, {
"adjacencies": [
"graphnode4",
{
"nodeTo": "graphnode3",
"nodeFrom": "graphnode4",
"data": {
"$color": "#557EAA"
}
}, {
"nodeTo": "graphnode5",
"nodeFrom": "graphnode4",
"data": {
"$color": "#909291"
}
}, {
"nodeTo": "graphnode8",
"nodeFrom": "graphnode4",
"data": {
"$color": "#557EAA"
}
}
],
"data": {
"$color": "#83548B",
"$type": "circle",
"$dim": 8
},
"id": "graphnode4",
"name": "graphnode4"
}, {
"adjacencies": [
"graphnode5",
{
"nodeTo": "graphnode4",
"nodeFrom": "graphnode5",
"data": {
"$color": "#557EAA"
}
}, {
"nodeTo": "graphnode0",
"nodeFrom": "graphnode5",
"data": {
"$color": "#909291"
}
}, {
"nodeTo": "graphnode6",
"nodeFrom": "graphnode5",
"data": {
"$color": "#557EAA"
}
}
],
"data": {
"$color": "#83548B",
"$type": "circle",
"$dim": 8
},
"id": "graphnode5",
"name": "graphnode5"
}, {
"adjacencies": [
"graphnode6",
{
"nodeTo": "graphnode5",
"nodeFrom": "graphnode6",
"data": {
"$color": "#557EAA"
}
}, {
"nodeTo": "graphnode2",
"nodeFrom": "graphnode6",
"data": {
"$color": "#909291"
}
}, {
"nodeTo": "graphnode7",
"nodeFrom": "graphnode6",
"data": {
"$color": "#557EAA"
}
}
],
"data": {
"$color": "#83548B",
"$type": "circle",
"$dim": 8
},
"id": "graphnode6",
"name": "graphnode6"
}, {
"adjacencies": [
"graphnode7",
{
"nodeTo": "graphnode6",
"nodeFrom": "graphnode7",
"data": {
"$color": "#557EAA"
}
}, {
"nodeTo": "graphnode8",
"nodeFrom": "graphnode7",
"data": {
"$color": "#909291"
}
}, {
"nodeTo": "graphnode9",
"nodeFrom": "graphnode7",
"data": {
"$color": "#557EAA"
}
}
],
"data": {
"$color": "#83548B",
"$type": "circle",
"$dim": 8
},
"id": "graphnode7",
"name": "graphnode7"
}, {
"adjacencies": [
"graphnode8",
{
"nodeTo": "graphnode1",
"nodeFrom": "graphnode8",
"data": {
"$color": "#557EAA"
}
}, {
"nodeTo": "graphnode4",
"nodeFrom": "graphnode8",
"data": {
"$color": "#909291"
}
}, {
"nodeTo": "graphnode7",
"nodeFrom": "graphnode8",
"data": {
"$color": "#557EAA"
}
}
],
"data": {
"$color": "#83548B",
"$type": "circle",
"$dim": 8
},
"id": "graphnode8",
"name": "graphnode8"
}, {
"adjacencies": [
"graphnode9",
{
"nodeTo": "graphnode0",
"nodeFrom": "graphnode9",
"data": {
"$color": "#557EAA"
}
}, {
"nodeTo": "graphnode3",
"nodeFrom": "graphnode9",
"data": {
"$color": "#909291"
}
}, {
"nodeTo": "graphnode7",
"nodeFrom": "graphnode9",
"data": {
"$color": "#557EAA"
}
}
],
"data": {
"$color": "#83548B",
"$type": "circle",
"$dim": 8
},
"id": "graphnode9",
"name": "graphnode9"
}
];
// end
// init ForceDirected
var fd = new $jit.ForceDirected({
//id of the visualization container
injectInto: 'infovis',
//Enable zooming and panning
//by scrolling and DnD
Navigation: {
enable: true,
//Enable panning events only if we're dragging the empty
//canvas (and not a node).
panning: 'avoid nodes',
zooming: 10 //zoom speed. higher is more sensible
},
// Change node and edge styles such as
// color and width.
// These properties are also set per node
// with dollar prefixed data-properties in the
// JSON structure.
Node: {
overridable: true
},
Edge: {
overridable: true,
color: '#23A4FF',
lineWidth: 0.4
},
//Native canvas text styling
Label: {
type: labelType, //Native or HTML
size: 10,
style: 'bold'
},
//Add Tips
Tips: {
enable: true,
onShow: function(tip, node) {
//count connections
var count = 0;
node.eachAdjacency(function() { count++; });
//display node info in tooltip
tip.innerHTML = "<div class=\"tip-title\">" + node.name + "</div>"
+ "<div class=\"tip-text\"><b>connections:</b> " + count + "</div>";
}
},
// Add node events
Events: {
enable: true,
type: 'Native',
//Change cursor style when hovering a node
onMouseEnter: function() {
fd.canvas.getElement().style.cursor = 'move';
},
onMouseLeave: function() {
fd.canvas.getElement().style.cursor = '';
},
//Update node positions when dragged
onDragMove: function(node, eventInfo, e) {
var pos = eventInfo.getPos();
node.pos.setc(pos.x, pos.y);
fd.plot();
},
//Implement the same handler for touchscreens
onTouchMove: function(node, eventInfo, e) {
$jit.util.event.stop(e); //stop default touchmove event
this.onDragMove(node, eventInfo, e);
},
//Add also a click handler to nodes
onClick: function(node) {
if(!node) return;
// Build the right column relations list.
// This is done by traversing the clicked node connections.
var html = "<h4>" + node.name + "</h4><b> connections:</b><ul><li>",
list = [];
node.eachAdjacency(function(adj){
list.push(adj.nodeTo.name);
});
//append connections information
$jit.id('inner-details').innerHTML = html + list.join("</li><li>") + "</li></ul>";
}
},
//Number of iterations for the FD algorithm
iterations: 200,
//Edge length
levelDistance: 130,
// Add text to the labels. This method is only triggered
// on label creation and only for DOM labels (not native canvas ones).
onCreateLabel: function(domElement, node){
domElement.innerHTML = node.name;
var style = domElement.style;
style.fontSize = "0.8em";
style.color = "#ddd";
},
// Change node styles when DOM labels are placed
// or moved.
onPlaceLabel: function(domElement, node){
var style = domElement.style;
var left = parseInt(style.left);
var top = parseInt(style.top);
var w = domElement.offsetWidth;
style.left = (left - w / 2) + 'px';
style.top = (top + 10) + 'px';
style.display = '';
}
});
// load JSON data.
fd.loadJSON(json);
// compute positions incrementally and animate.
fd.computeIncremental({
iter: 40,
property: 'end',
onStep: function(perc){
Log.write(perc + '% loaded...');
},
onComplete: function(){
Log.write('done');
fd.animate({
modes: ['linear'],
transition: $jit.Trans.Elastic.easeOut,
duration: 2500
});
}
});
// end
}

File diff suppressed because one or more lines are too long

View file

@ -36,7 +36,7 @@ Kantenmenge bezeichnet.
\begin{frame}{Inzidenz}
\begin{block}{Inzidenz}
Sei $e \in E$ und $k = \Set{v_1, v_2} \in K$.
Sei $e \in E$ und $k = \Set{e_1, e_2} \in K$.
$e$ heißt \textbf{inzident} zu $k :\Leftrightarrow e = e_1$ oder $e = e_2$
\end{block}

View file

@ -30,7 +30,6 @@ Ein Graph heißt \textbf{eulersch}, wenn er einen eulerschen Kreis enthält.
\pgfsetlayers{background,main}
\begin{frame}{Eulerscher Kreis}
\newcommand\n{5}
\tikzstyle{selected edge} = [draw,line width=5pt,-,red!50]
\begin{center}
\adjustbox{max size={\textwidth}{0.8\textheight}}{
\begin{tikzpicture}

View file

@ -130,9 +130,9 @@ seine \textbf{Länge}.
\begin{frame}{Geschlossener Kantenzug}
\begin{block}{Geschlossener Kantenzug}
Sei $G = (V, E)$ ein Graph und $A = (e_1, e_2 \dots, e_s)$ ein Kantenzug.
Sei $G = (E, K)$ ein Graph und $A = (e_0, e_1, \dots, e_s)$ ein Kantenzug.
A heißt \textbf{geschlossen} $:\Leftrightarrow v_s = v_0$ .
A heißt \textbf{geschlossen} $:\Leftrightarrow e_s = e_0$ .
\end{block}
\begin{gallery}
@ -149,9 +149,9 @@ A heißt \textbf{geschlossen} $:\Leftrightarrow v_s = v_0$ .
\begin{frame}{Weg}
\begin{block}{Weg}
Sei $G = (V, E)$ ein Graph und $A = (e_1, e_2 \dots, e_s)$ ein Kantenzug.
Sei $G = (E, K)$ ein Graph und $A = (k_1, k_2 \dots, k_s)$ ein Kantenzug.
A heißt \textbf{Weg} $:\Leftrightarrow \forall_{i, j \in [1, s] \cap \mathbb{N}}: i \neq j \Rightarrow e_i \neq e_j$ .
A heißt \textbf{Weg} $:\Leftrightarrow \forall_{i, j \in 1, \dots, s}: i \neq j \Rightarrow k_i \neq k_j$ .
\end{block}
\pause
@ -167,7 +167,7 @@ Achtung: Knoten dürfen mehrfach abgelaufen werden!
\begin{frame}{Kreis}
\begin{block}{Kreis}
Sei $G = (V, E)$ ein Graph und $A = (e_1, e_2 \dots, e_s)$ ein Kantenzug.
Sei $G = (E, K)$ ein Graph und $A = (k_1, k_2 \dots, k_s)$ ein Kantenzug.
A heißt \textbf{Kreis} $:\Leftrightarrow A$ ist geschlossen und ein Weg.
\end{block}
@ -175,13 +175,20 @@ A heißt \textbf{Kreis} $:\Leftrightarrow A$ ist geschlossen und ein Weg.
\pause
Manchmal wird das auch "`einfacher Kreis"' genannt.
\pause
\begin{gallery}
\galleryimage[Green]{graphs/circle-one-facet}
\galleryimage[Green]{graphs/circle-two-facets}
\end{gallery}
\end{frame}
\begin{frame}{Zusammenhängender Graph}
\begin{block}{Zusammenhängender Graph}
Sei $G = (V, E)$ ein Graph.
Sei $G = (E, K)$ ein Graph.
$G$ heißt \textbf{zusammenhängend} $:\Leftrightarrow \forall v_1, v_2 \in V: $ Es ex. ein Kantenzug, der $v_1$ und $v_2$ verbindet
$G$ heißt \textbf{zusammenhängend} $:\Leftrightarrow \forall e_1, e_2 \in E: $ Es ex. ein Kantenzug, der $e_1$ und $e_2$ verbindet
\end{block}
\begin{gallery}

View file

@ -0,0 +1,36 @@
\documentclass[varwidth=true, border=2pt]{standalone}
\usepackage{tikz}
\usetikzlibrary{arrows,positioning}
\tikzset{
%Define standard arrow tip
>=stealth',
% Define arrow style
pil/.style={->,thick}
}
\begin{document}
\begin{tikzpicture}
\node (a)[vertex] at (0,0) {};
\node (b)[vertex] at (1,1) {};
\node (c)[vertex] at (2,1) {};
\node (d)[vertex] at (3,0) {};
\node (e)[vertex] at (4,1) {};
\node (f)[vertex] at (5,1) {};
\node (g)[vertex] at (6,0) {};
\node (h)[vertex] at (5,-1) {};
\node (i)[vertex] at (4,-1) {};
%\node (j)[vertex] at (3,0) {};
\node (k)[vertex] at (2,-1) {};
\node (l)[vertex] at (1,-1) {};
\node (m)[vertex] at (2,2) {};
\node (n)[vertex] at (3,2) {};
\foreach \from/\to in {a/b,b/c,c/d,d/k,k/l,l/a}
\draw[selected edge] (\from) -- (\to);
\foreach \from/\to in {a/b,b/c,c/d,d/e,e/f,f/g,g/h,h/i,i/d,d/k,k/l,l/a}
\draw[line width=2pt] (\from) -- (\to);
\draw[line width=2pt] (b) -- (m);
\draw[line width=2pt] (m) -- (n);
\end{tikzpicture}
\end{document}

View file

@ -0,0 +1,36 @@
\documentclass[varwidth=true, border=2pt]{standalone}
\usepackage{tikz}
\usetikzlibrary{arrows,positioning}
\tikzset{
%Define standard arrow tip
>=stealth',
% Define arrow style
pil/.style={->,thick}
}
\begin{document}
\begin{tikzpicture}
\node (a)[vertex] at (0,0) {};
\node (b)[vertex] at (1,1) {};
\node (c)[vertex] at (2,1) {};
\node (d)[vertex] at (3,0) {};
\node (e)[vertex] at (4,1) {};
\node (f)[vertex] at (5,1) {};
\node (g)[vertex] at (6,0) {};
\node (h)[vertex] at (5,-1) {};
\node (i)[vertex] at (4,-1) {};
%\node (j)[vertex] at (3,0) {};
\node (k)[vertex] at (2,-1) {};
\node (l)[vertex] at (1,-1) {};
\node (m)[vertex] at (2,2) {};
\node (n)[vertex] at (3,2) {};
\foreach \from/\to in {a/b,b/c,c/d,d/e,e/f,f/g,g/h,h/i,i/d,d/k,k/l,l/a}
\draw[selected edge] (\from) -- (\to);
\foreach \from/\to in {a/b,b/c,c/d,d/e,e/f,f/g,g/h,h/i,i/d,d/k,k/l,l/a}
\draw[line width=2pt] (\from) -- (\to);
\draw[line width=2pt] (b) -- (m);
\draw[line width=2pt] (m) -- (n);
\end{tikzpicture}
\end{document}

View file

@ -132,5 +132,6 @@
\definecolor{Green}{HTML}{BEF781}
\tikzstyle{vertex}=[draw,fill=black,circle,minimum size=10pt,inner sep=0pt]
\tikzstyle{selected edge} = [draw,line width=5pt,-,red!50]
\def\TCop{\textsuperscript{\textcopyright}} % Copyright-sign
\usepackage{mathtools}