Add creating graph using Edge List.

This commit is contained in:
Oleg Sh 2022-09-18 13:19:53 +02:00
parent b3838b70ca
commit 4b82685aaa
40 changed files with 644 additions and 1 deletions

View File

@ -0,0 +1,47 @@
.form-inline
{
.checkbox
{
margin-right: 12px;
}
}
#PairFieldPage
{
overflow: scroll;
width: 100%;
height: 300px;
overflow-wrap: normal;
}
#AdjacencyMatrixFieldInput
{
overflow: scroll;
max-width: 100%;
max-height: 300px;
overflow-x: scroll;
white-space:nowrap;
}
#BadFormatMessage
{
padding: 8px;
display: none;
}
::-webkit-scrollbar {
-webkit-appearance: none;
width: 7px;
height: 7px;
}
::-webkit-scrollbar-thumb {
border-radius: 4px;
background-color: rgba(0,0,0,.5);
-webkit-box-shadow: 0 0 1px rgba(255,255,255,.5);
}
#CreateByPair {
margin-bottom: 8px;
}

View File

@ -0,0 +1,19 @@
<?php
$g_lang['head_no_tags'] = 'Creating graph by Edge List';
$g_lang['text'] = '<p>On this page you can enter&nbsp;edge list and plot graph</p>';
$g_lang['pair_description'] = 'Enter edge list. Each edge should be placed on a new line. Use "<b>-</b>" as separator between vertices. E.g. <b>1-2</b>. <small>Read about extended format below.</small>';
$g_lang['plot_graph_button'] = 'Plot graph';
$g_lang['pair_bad_format'] = 'Edge list format is incorrect. Format of edge should be like: vertex1-vertex2. <small>Read about extension format below.</small>';
$g_lang['ex_pair_format'] = "Extended format";
$g_lang['ex_pair_forma_description'] ="Using extended format you may set up directed and weighted edges. Разные варианты использования:
<ul>
<li><b>a-b</b> - edge between <b>a</b> and <b>b</b>.</li>
<li><b>a>b</b> - directed edge from <b>a</b> to <b>b</b>.</li>
<li><b>a&lt;b</b> - directed edge from <b>a</b> to <b>b</b>. </li>
<li><b>a-(8)-b</b> - weighted edge between <b>a</b> and <b>b</b> with weigth <b>8</b>.</li>
<li><b>a-(3.5)>b</b> - directed edge from <b>a</b> to <b>b</b> with weight <b>3.5</b>.</li>
<li><b>a<(1)-b</b> - directed edge from <b>b</b> to <b>a</b> with weight <b>1</b>.</li>
</ul>";
$g_lang['edge_list'] = 'Edge List';
?>

View File

@ -288,4 +288,8 @@ We have added Dutch translation 🇳🇱. Thank you Willie de Wit</a>";
$g_lang['make_all_directed'] = "Make all edges directed";
$g_lang['save_svg_image'] = "Save graph to SVG";
$g_lang["bad_inc_pair_message"] = "Cannot create graph. Edge list has wrong format. Click \"fix\" button to fix edge list or \"help\" button to open help about format";
$g_lang["edge_list_wrong_format"] = "Edge list format is incorrect";
$g_lang["fix_button"] = "fix";
?>

View File

@ -11,6 +11,7 @@
$g_lang["menu_8"] = "Новини";
$g_lang["menu_9"] = "Пример за използване на граф";
$g_lang["menu_10"] = "Отворен код";
$g_lang["menu_11"] = "Using edge list";
$g_lang["footer_info"] = "<a href=\"/en/\">Онлайн Граф</a>&nbsp;е проект с отворен код, насочен към&nbsp;създаване и лесна визуализация на граф и <a href=\"/en/\">търсене на най-кратък път</a>. Освен това можете да създадете&nbsp;<a href=\"http://graphonline.ru/en/create_graph_by_matrix\">граф от матрица на съседство</a>.&nbsp;<a href=\"/en/about\">Повече за проекта</a> и <a href=\"http://graphonline.ru/en/help\">страница за помощ</a>.\n";
$g_lang["lang"] = "Language";
?>

View File

@ -0,0 +1,19 @@
<?php
$g_lang['head_no_tags'] = 'Creating graph by Edge List';
$g_lang['text'] = '<p>On this page you can enter&nbsp;edge list and plot graph</p>';
$g_lang['pair_description'] = 'Enter edge list. Each edge should be placed on a new line. Use "<b>-</b>" as separator between vertices. E.g. <b>1-2</b>. <small>Read about extended format below.</small>';
$g_lang['plot_graph_button'] = 'Plot graph';
$g_lang['pair_bad_format'] = 'Edge list format is incorrect. Format of edge should be like: vertex1-vertex2. <small>Read about extension format below.</small>';
$g_lang['ex_pair_format'] = "Extended format";
$g_lang['ex_pair_forma_description'] ="Using extended format you may set up directed and weighted edges. Разные варианты использования:
<ul>
<li><b>a-b</b> - edge between <b>a</b> and <b>b</b>.</li>
<li><b>a>b</b> - directed edge from <b>a</b> to <b>b</b>.</li>
<li><b>a&lt;b</b> - directed edge from <b>a</b> to <b>b</b>. </li>
<li><b>a-(8)-b</b> - weighted edge between <b>a</b> and <b>b</b> with weigth <b>8</b>.</li>
<li><b>a-(3.5)>b</b> - directed edge from <b>a</b> to <b>b</b> with weight <b>3.5</b>.</li>
<li><b>a<(1)-b</b> - directed edge from <b>b</b> to <b>a</b> with weight <b>1</b>.</li>
</ul>";
$g_lang['edge_list'] = 'Edge List';
?>

View File

@ -288,4 +288,8 @@
$g_lang['make_all_directed'] = "Make all edges directed";
$g_lang['save_svg_image'] = "Save graph to SVG";
$g_lang["bad_inc_pair_message"] = "Cannot create graph. Edge list has wrong format. Click \"fix\" button to fix edge list or \"help\" button to open help about format";
$g_lang["edge_list_wrong_format"] = "Edge list format is incorrect";
$g_lang["fix_button"] = "fix";
?>

View File

@ -11,6 +11,7 @@
$g_lang["menu_8"] = "新闻";
$g_lang["menu_9"] = "使用图的例子";
$g_lang["menu_10"] = "开源";
$g_lang["menu_11"] = "Using edge list";
$g_lang["footer_info"] = "<a href=\"/en/\">Graph Online</a>&nbsp;是一个在线项目为了帮助&nbsp;创造和可视化图 <a href=\"/en/\">寻找最短路</a>. 你也可以创造使用&nbsp;<a href=\"http://graphonline.ru/en/create_graph_by_matrix\">邻接矩阵创造图</a>.&nbsp;<a href=\"/en/about\">关于项目</a> 和 <a href=\"http://graphonline.ru/en/help\">帮助页面</a>.\n";
$g_lang["lang"] = "语言";
?>

View File

@ -0,0 +1,19 @@
<?php
$g_lang['head_no_tags'] = 'Creating graph by Edge List';
$g_lang['text'] = '<p>On this page you can enter&nbsp;edge list and plot graph</p>';
$g_lang['pair_description'] = 'Enter edge list. Each edge should be placed on a new line. Use "<b>-</b>" as separator between vertices. E.g. <b>1-2</b>. <small>Read about extended format below.</small>';
$g_lang['plot_graph_button'] = 'Plot graph';
$g_lang['pair_bad_format'] = 'Edge list format is incorrect. Format of edge should be like: vertex1-vertex2. <small>Read about extension format below.</small>';
$g_lang['ex_pair_format'] = "Extended format";
$g_lang['ex_pair_forma_description'] ="Using extended format you may set up directed and weighted edges. Разные варианты использования:
<ul>
<li><b>a-b</b> - edge between <b>a</b> and <b>b</b>.</li>
<li><b>a>b</b> - directed edge from <b>a</b> to <b>b</b>.</li>
<li><b>a&lt;b</b> - directed edge from <b>a</b> to <b>b</b>. </li>
<li><b>a-(8)-b</b> - weighted edge between <b>a</b> and <b>b</b> with weigth <b>8</b>.</li>
<li><b>a-(3.5)>b</b> - directed edge from <b>a</b> to <b>b</b> with weight <b>3.5</b>.</li>
<li><b>a<(1)-b</b> - directed edge from <b>b</b> to <b>a</b> with weight <b>1</b>.</li>
</ul>";
$g_lang['edge_list'] = 'Edge List';
?>

View File

@ -251,4 +251,8 @@
$g_lang['make_all_directed'] = "Make all edges directed";
$g_lang['save_svg_image'] = "Save graph to SVG";
$g_lang["bad_inc_pair_message"] = "Cannot create graph. Edge list has wrong format. Click \"fix\" button to fix edge list or \"help\" button to open help about format";
$g_lang["edge_list_wrong_format"] = "Edge list format is incorrect";
$g_lang["fix_button"] = "fix";
?>

View File

@ -11,6 +11,7 @@
$g_lang["menu_8"] = "Nachrichten";
$g_lang["menu_9"] = "anhand dem Beispielgraph";
$g_lang["menu_10"] = "anhand eines Diagrammbeispiels";
$g_lang["menu_11"] = "Using edge list";
$g_lang["footer_info"] = "Graph Online ist ein online Projekt, der sich auf Erstellen und einfache Visualisierung des Graphes und kürzesten Pfad-Suche richtet. Außerdem, können Sie einen Graph via Adjazenzmatrix erstellen. ";
$g_lang["lang"] = "Sprache";
$g_lang["home_notg"] = "Home";

View File

@ -0,0 +1,19 @@
<?php
$g_lang['head_no_tags'] = 'Creating graph by Edge List';
$g_lang['text'] = '<p>On this page you can enter&nbsp;edge list and plot graph</p>';
$g_lang['pair_description'] = 'Enter edge list. Each edge should be placed on a new line. Use "<b>-</b>" as separator between vertices. E.g. <b>1-2</b>. <small>Read about extended format below.</small>';
$g_lang['plot_graph_button'] = 'Plot graph';
$g_lang['pair_bad_format'] = 'Edge list format is incorrect. Format of edge should be like: vertex1-vertex2. <small>Read about extension format below.</small>';
$g_lang['ex_pair_format'] = "Extended format";
$g_lang['ex_pair_forma_description'] ="Using extended format you may set up directed and weighted edges. Разные варианты использования:
<ul>
<li><b>a-b</b> - edge between <b>a</b> and <b>b</b>.</li>
<li><b>a>b</b> - directed edge from <b>a</b> to <b>b</b>.</li>
<li><b>a&lt;b</b> - directed edge from <b>a</b> to <b>b</b>. </li>
<li><b>a-(8)-b</b> - weighted edge between <b>a</b> and <b>b</b> with weigth <b>8</b>.</li>
<li><b>a-(3.5)>b</b> - directed edge from <b>a</b> to <b>b</b> with weight <b>3.5</b>.</li>
<li><b>a<(1)-b</b> - directed edge from <b>b</b> to <b>a</b> with weight <b>1</b>.</li>
</ul>";
$g_lang['edge_list'] = 'Edge List';
?>

View File

@ -289,4 +289,8 @@
$g_lang['make_all_directed'] = "Make all edges directed";
$g_lang['save_svg_image'] = "Save graph to SVG";
$g_lang["bad_inc_pair_message"] = "Cannot create graph. Edge list has wrong format. Click \"fix\" button to fix edge list or \"help\" button to open help about format";
$g_lang["edge_list_wrong_format"] = "Edge list format is incorrect";
$g_lang["fix_button"] = "fix";
?>

View File

@ -10,6 +10,7 @@
$g_lang["menu_8"] = "Νέα";
$g_lang["menu_9"] = "Από παραδείγματα γράφων";
$g_lang["menu_10"] = "Ανοιχτό λογισμικό";
$g_lang["menu_11"] = "Using edge list";
$g_lang["footer_info"] = "
<a href=\"/en/\">Το Graph Online</a>
είναι ενα online πρότζεκτ με στόχο την εύκολη δημιουργία και απεικόνιση γράφων.

View File

@ -0,0 +1,19 @@
<?php
$g_lang['head_no_tags'] = 'Creating graph by Edge List';
$g_lang['text'] = '<p>On this page you can enter&nbsp;edge list and plot graph</p>';
$g_lang['pair_description'] = 'Enter edge list. Each edge should be placed on a new line. Use "<b>-</b>" as separator between vertices. E.g. <b>1-2</b>. <small>Read about extended format below.</small>';
$g_lang['plot_graph_button'] = 'Plot graph';
$g_lang['pair_bad_format'] = 'Edge list format is incorrect. Format of edge should be like: vertex1-vertex2. <small>Read about extension format below.</small>';
$g_lang['ex_pair_format'] = "Extended format";
$g_lang['ex_pair_forma_description'] ="Using extended format you may set up directed and weighted edges. Разные варианты использования:
<ul>
<li><b>a-b</b> - edge between <b>a</b> and <b>b</b>.</li>
<li><b>a>b</b> - directed edge from <b>a</b> to <b>b</b>.</li>
<li><b>a&lt;b</b> - directed edge from <b>a</b> to <b>b</b>. </li>
<li><b>a-(8)-b</b> - weighted edge between <b>a</b> and <b>b</b> with weigth <b>8</b>.</li>
<li><b>a-(3.5)>b</b> - directed edge from <b>a</b> to <b>b</b> with weight <b>3.5</b>.</li>
<li><b>a<(1)-b</b> - directed edge from <b>b</b> to <b>a</b> with weight <b>1</b>.</li>
</ul>";
$g_lang['edge_list'] = 'Edge List';
?>

View File

@ -288,4 +288,8 @@ We have added Dutch translation 🇳🇱. Thank you Willie de Wit</a>";
$g_lang['make_all_directed'] = "Make all edges directed";
$g_lang['save_svg_image'] = "Save graph to SVG";
$g_lang["bad_inc_pair_message"] = "Cannot create graph. Edge list has wrong format. Click \"fix\" button to fix edge list or \"help\" button to open help about format";
$g_lang["edge_list_wrong_format"] = "Edge list format is incorrect";
$g_lang["fix_button"] = "fix";
?>

View File

@ -11,6 +11,7 @@
$g_lang["menu_8"] = "News";
$g_lang["menu_9"] = "Using graph example";
$g_lang["menu_10"] = "Open source";
$g_lang["menu_11"] = "Using edge list";
$g_lang["footer_info"] = "<a href=\"/en/\">Graph Online</a>&nbsp;is online project aimed at&nbsp;creation and easy visualization of graph and <a href=\"/en/\">shortest path searching</a>. Also you can create&nbsp;<a href=\"http://graphonline.ru/en/create_graph_by_matrix\">graph from adjacency matrix</a>.&nbsp;<a href=\"/en/about\">About project</a> and <a href=\"http://graphonline.ru/en/help\">look help page</a>.\n";
$g_lang["lang"] = "Language";
?>

View File

@ -0,0 +1,19 @@
<?php
$g_lang['head_no_tags'] = 'Creating graph by Edge List';
$g_lang['text'] = '<p>On this page you can enter&nbsp;edge list and plot graph</p>';
$g_lang['pair_description'] = 'Enter edge list. Each edge should be placed on a new line. Use "<b>-</b>" as separator between vertices. E.g. <b>1-2</b>. <small>Read about extended format below.</small>';
$g_lang['plot_graph_button'] = 'Plot graph';
$g_lang['pair_bad_format'] = 'Edge list format is incorrect. Format of edge should be like: vertex1-vertex2. <small>Read about extension format below.</small>';
$g_lang['ex_pair_format'] = "Extended format";
$g_lang['ex_pair_forma_description'] ="Using extended format you may set up directed and weighted edges. Разные варианты использования:
<ul>
<li><b>a-b</b> - edge between <b>a</b> and <b>b</b>.</li>
<li><b>a>b</b> - directed edge from <b>a</b> to <b>b</b>.</li>
<li><b>a&lt;b</b> - directed edge from <b>a</b> to <b>b</b>. </li>
<li><b>a-(8)-b</b> - weighted edge between <b>a</b> and <b>b</b> with weigth <b>8</b>.</li>
<li><b>a-(3.5)>b</b> - directed edge from <b>a</b> to <b>b</b> with weight <b>3.5</b>.</li>
<li><b>a<(1)-b</b> - directed edge from <b>b</b> to <b>a</b> with weight <b>1</b>.</li>
</ul>";
$g_lang['edge_list'] = 'Edge List';
?>

View File

@ -288,4 +288,8 @@ Tenemos traducciones en griego 🇬🇷.</a> <a href=\"https://github.com/UnickS
$g_lang['make_all_directed'] = "Make all edges directed";
$g_lang['save_svg_image'] = "Save graph to SVG";
$g_lang["bad_inc_pair_message"] = "Cannot create graph. Edge list has wrong format. Click \"fix\" button to fix edge list or \"help\" button to open help about format";
$g_lang["edge_list_wrong_format"] = "Edge list format is incorrect";
$g_lang["fix_button"] = "fix";
?>

View File

@ -11,6 +11,7 @@
$g_lang["menu_8"] = "Novedades";
$g_lang["menu_9"] = "Usar grafo de ejemplo";
$g_lang["menu_10"] = "Código abierto";
$g_lang["menu_11"] = "Using edge list";
$g_lang["footer_info"] = "<a href=\"/en/\">Graph Online</a>&nbsp;es un proyecto en línea que apunta a la&nbsp;creación y fácil visualización de grafos y <a href=\"/en/\">búsqueda de caminos más cortos</a>. Además puedes crear&nbsp;<a href=\"http://graphonline.ru/en/create_graph_by_matrix\">grafos a partir de matrices de adyacencia</a>.&nbsp;<a href=\"/en/about\">Acerca del proyecto</a> y <a href=\"http://graphonline.ru/en/help\">consulta nuestra página de ayuda</a>.\n";
$g_lang["lang"] = "Idioma";
?>

View File

@ -0,0 +1,19 @@
<?php
$g_lang['head_no_tags'] = 'Creating graph by Edge List';
$g_lang['text'] = '<p>On this page you can enter&nbsp;edge list and plot graph</p>';
$g_lang['pair_description'] = 'Enter edge list. Each edge should be placed on a new line. Use "<b>-</b>" as separator between vertices. E.g. <b>1-2</b>. <small>Read about extended format below.</small>';
$g_lang['plot_graph_button'] = 'Plot graph';
$g_lang['pair_bad_format'] = 'Edge list format is incorrect. Format of edge should be like: vertex1-vertex2. <small>Read about extension format below.</small>';
$g_lang['ex_pair_format'] = "Extended format";
$g_lang['ex_pair_forma_description'] ="Using extended format you may set up directed and weighted edges. Разные варианты использования:
<ul>
<li><b>a-b</b> - edge between <b>a</b> and <b>b</b>.</li>
<li><b>a>b</b> - directed edge from <b>a</b> to <b>b</b>.</li>
<li><b>a&lt;b</b> - directed edge from <b>a</b> to <b>b</b>. </li>
<li><b>a-(8)-b</b> - weighted edge between <b>a</b> and <b>b</b> with weigth <b>8</b>.</li>
<li><b>a-(3.5)>b</b> - directed edge from <b>a</b> to <b>b</b> with weight <b>3.5</b>.</li>
<li><b>a<(1)-b</b> - directed edge from <b>b</b> to <b>a</b> with weight <b>1</b>.</li>
</ul>";
$g_lang['edge_list'] = 'Edge List';
?>

View File

@ -256,4 +256,8 @@
$g_lang['make_all_directed'] = "Make all edges directed";
$g_lang['save_svg_image'] = "Save graph to SVG";
$g_lang["bad_inc_pair_message"] = "Cannot create graph. Edge list has wrong format. Click \"fix\" button to fix edge list or \"help\" button to open help about format";
$g_lang["edge_list_wrong_format"] = "Edge list format is incorrect";
$g_lang["fix_button"] = "fix";
?>

View File

@ -11,6 +11,7 @@
$g_lang["menu_8"] = "Nouveau";
$g_lang["menu_9"] = "En utilisant un graph en exemple";
$g_lang["menu_10"] = "Droit libre";
$g_lang["menu_11"] = "Using edge list";
$g_lang["footer_info"] = "<a href=\"/fr/\">Graph Online</a> est un projet en ligne pour créer et visualiser facilement des graphes, et également rechercher &nbsp;<a href=\"http://graphonline.ru/fr\">le chemin le plus court</a>. L'on peut également créer des graphes à partir de leurs matrices d'adjacence. A propos du projet et acces à la page d'aide.";
$g_lang["lang"] = "Langue";
$g_lang["home"] = "Maison";

View File

@ -0,0 +1,19 @@
<?php
$g_lang['head_no_tags'] = 'Creating graph by Edge List';
$g_lang['text'] = '<p>On this page you can enter&nbsp;edge list and plot graph</p>';
$g_lang['pair_description'] = 'Enter edge list. Each edge should be placed on a new line. Use "<b>-</b>" as separator between vertices. E.g. <b>1-2</b>. <small>Read about extended format below.</small>';
$g_lang['plot_graph_button'] = 'Plot graph';
$g_lang['pair_bad_format'] = 'Edge list format is incorrect. Format of edge should be like: vertex1-vertex2. <small>Read about extension format below.</small>';
$g_lang['ex_pair_format'] = "Extended format";
$g_lang['ex_pair_forma_description'] ="Using extended format you may set up directed and weighted edges. Разные варианты использования:
<ul>
<li><b>a-b</b> - edge between <b>a</b> and <b>b</b>.</li>
<li><b>a>b</b> - directed edge from <b>a</b> to <b>b</b>.</li>
<li><b>a&lt;b</b> - directed edge from <b>a</b> to <b>b</b>. </li>
<li><b>a-(8)-b</b> - weighted edge between <b>a</b> and <b>b</b> with weigth <b>8</b>.</li>
<li><b>a-(3.5)>b</b> - directed edge from <b>a</b> to <b>b</b> with weight <b>3.5</b>.</li>
<li><b>a<(1)-b</b> - directed edge from <b>b</b> to <b>a</b> with weight <b>1</b>.</li>
</ul>";
$g_lang['edge_list'] = 'Edge List';
?>

View File

@ -253,4 +253,8 @@
$g_lang['make_all_directed'] = "Make all edges directed";
$g_lang['save_svg_image'] = "Save graph to SVG";
$g_lang["bad_inc_pair_message"] = "Cannot create graph. Edge list has wrong format. Click \"fix\" button to fix edge list or \"help\" button to open help about format";
$g_lang["edge_list_wrong_format"] = "Edge list format is incorrect";
$g_lang["fix_button"] = "fix";
?>

View File

@ -11,6 +11,7 @@
$g_lang["menu_8"] = "Nieuws";
$g_lang["menu_9"] = "Gebruik voorbeeld graaf";
$g_lang["menu_10"] = "Open source";
$g_lang["menu_11"] = "Using edge list";
$g_lang["footer_info"] = "Graph Online is een online project met als doel het creëren en eenvoudig visualiseren van grafen en het vinden van een kortste route. Verder kunt u ook grafen creëren middels bogenmatrixen. Meer info over het project vind u op de help pagina ";
$g_lang["lang"] = "Taal";

View File

@ -0,0 +1,19 @@
<?php
$g_lang['head_no_tags'] = 'Creating graph by Edge List';
$g_lang['text'] = '<p>On this page you can enter&nbsp;edge list and plot graph</p>';
$g_lang['pair_description'] = 'Enter edge list. Each edge should be placed on a new line. Use "<b>-</b>" as separator between vertices. E.g. <b>1-2</b>. <small>Read about extended format below.</small>';
$g_lang['plot_graph_button'] = 'Plot graph';
$g_lang['pair_bad_format'] = 'Edge list format is incorrect. Format of edge should be like: vertex1-vertex2. <small>Read about extension format below.</small>';
$g_lang['ex_pair_format'] = "Extended format";
$g_lang['ex_pair_forma_description'] ="Using extended format you may set up directed and weighted edges. Разные варианты использования:
<ul>
<li><b>a-b</b> - edge between <b>a</b> and <b>b</b>.</li>
<li><b>a>b</b> - directed edge from <b>a</b> to <b>b</b>.</li>
<li><b>a&lt;b</b> - directed edge from <b>a</b> to <b>b</b>. </li>
<li><b>a-(8)-b</b> - weighted edge between <b>a</b> and <b>b</b> with weigth <b>8</b>.</li>
<li><b>a-(3.5)>b</b> - directed edge from <b>a</b> to <b>b</b> with weight <b>3.5</b>.</li>
<li><b>a<(1)-b</b> - directed edge from <b>b</b> to <b>a</b> with weight <b>1</b>.</li>
</ul>";
$g_lang['edge_list'] = 'Edge List';
?>

View File

@ -254,4 +254,8 @@
$g_lang['make_all_directed'] = "Make all edges directed";
$g_lang['save_svg_image'] = "Save graph to SVG";
$g_lang["bad_inc_pair_message"] = "Cannot create graph. Edge list has wrong format. Click \"fix\" button to fix edge list or \"help\" button to open help about format";
$g_lang["edge_list_wrong_format"] = "Edge list format is incorrect";
$g_lang["fix_button"] = "fix";
?>

View File

@ -11,6 +11,7 @@
$g_lang["menu_8"] = "News";
$g_lang["menu_9"] = "Usando grafo de exemplo";
$g_lang["menu_10"] = "Open Source";
$g_lang["menu_11"] = "Using edge list";
$g_lang["footer_info"] = "Grph Online é um projeto que mira a criação e visualização fácil de um grafo e a busca de seu melhor caminho. Você também pode criar um grafo através de uma matriz de adjacência. Sobre o projeto e visitar a página de ajuda";
$g_lang["lang"] = "Língua";
$g_lang["home"] = "Home";

View File

@ -0,0 +1,19 @@
<?php
$g_lang['head_no_tags'] = 'Создание графа по списку рёбер';
$g_lang['text'] = '<p>На данной странице вы можете задать список рёбер и построить по нему граф.</p>';
$g_lang['pair_description'] = 'Задайте список рёбер, каждое ребро должно быть на новой строке и используйте в качестве разделителя между вершинами "<b>-</b>". Например: <b>1-2</b>. <small>Читайте ниже о расширеном формате.</small>';
$g_lang['plot_graph_button'] = 'Построить граф';
$g_lang['pair_bad_format'] = 'Не правильный формат. Ребро должно иметь формат: вершина1-вершина2. <small>Читайте о расширеном формате ниже.</small>';
$g_lang['ex_pair_format'] = "Расширеный формат";
$g_lang['ex_pair_forma_description'] =" С помощью расширеного формата можно задавать орентированные и нагруженные дуги. Разные варианты использования:
<ul>
<li><b>a-b</b> - дуга между <b>a</b> и <b>b</b>.</li>
<li><b>a>b</b> - ориентированная дуга из <b>a</b> в <b>b</b>.</li>
<li><b>a&lt;b</b> - ориентированная дуга из <b>a</b> в <b>b</b>. </li>
<li><b>a-(8)-b</b> - нагруженная дуга между <b>a</b> и <b>b</b> с весом <b>8</b>.</li>
<li><b>a-(3.5)>b</b> - ориентированная дуга из <b>a</b> в <b>b</b> с весом <b>3.5</b>.</li>
<li><b>a<(1)-b</b> - ориентированная дуга из <b>b</b> в <b>a</b> c весом <b>1</b>.</li>
</ul>";
$g_lang['edge_list'] = 'Список рёбер';
?>

View File

@ -291,4 +291,8 @@
$g_lang['save_svg_image'] = "Сохранить граф в SVG";
$g_lang["bad_inc_pair_message"] = "Ошибка создания графа. Список рёбер имеет неправильный формат. Нажимте кнопку \"исправить\" чтобы исправить список или кнопку \"справка\" чтобы открыть справку о формате";
$g_lang["edge_list_wrong_format"] = "Неправильный формат списка рёбер";
$g_lang["fix_button"] = "исправить";
?>

View File

@ -11,6 +11,7 @@
$g_lang["menu_8"] = "Новости";
$g_lang["menu_9"] = "По примеру";
$g_lang["menu_10"] = "Открытый исходный код";
$g_lang["menu_11"] = "По списку рёбер";
$g_lang["footer_info"] = "<a href=\"/\">Граф Online</a> - создание и визуализация графа в два клика или по матрице смежности и&nbsp;<a href=\"http://graphonline.ru/\">поиск кратчайшего пути</a>, поиск компоненты связности, поиск&nbsp;Эйлеровго&nbsp;цикла.&nbsp;Поделиться: <a href=\"https://twitter.com/intent/tweet?url=http://graphonline.ru/&amp;text=Визуализация графа и поиск кратчайшего пути\" target=\"_blank\">Twitter</a>, <a href=\"http://vkontakte.ru/share.php?url=u=http://graphonline.ru/&amp;text=Визуализация графа и поиск кратчайшего пути\" target=\"_blank\">В Контакте</a>.\n";
$g_lang["lang"] = "Язык";
?>

View File

@ -0,0 +1,19 @@
<?php
$g_lang['head_no_tags'] = 'Creating graph by Edge List';
$g_lang['text'] = '<p>On this page you can enter&nbsp;edge list and plot graph</p>';
$g_lang['pair_description'] = 'Enter edge list. Each edge should be placed on a new line. Use "<b>-</b>" as separator between vertices. E.g. <b>1-2</b>. <small>Read about extended format below.</small>';
$g_lang['plot_graph_button'] = 'Plot graph';
$g_lang['pair_bad_format'] = 'Edge list format is incorrect. Format of edge should be like: vertex1-vertex2. <small>Read about extension format below.</small>';
$g_lang['ex_pair_format'] = "Extended format";
$g_lang['ex_pair_forma_description'] ="Using extended format you may set up directed and weighted edges. Разные варианты использования:
<ul>
<li><b>a-b</b> - edge between <b>a</b> and <b>b</b>.</li>
<li><b>a>b</b> - directed edge from <b>a</b> to <b>b</b>.</li>
<li><b>a&lt;b</b> - directed edge from <b>a</b> to <b>b</b>. </li>
<li><b>a-(8)-b</b> - weighted edge between <b>a</b> and <b>b</b> with weigth <b>8</b>.</li>
<li><b>a-(3.5)>b</b> - directed edge from <b>a</b> to <b>b</b> with weight <b>3.5</b>.</li>
<li><b>a<(1)-b</b> - directed edge from <b>b</b> to <b>a</b> with weight <b>1</b>.</li>
</ul>";
$g_lang['edge_list'] = 'Edge List';
?>

View File

@ -250,4 +250,8 @@
$g_lang['make_all_directed'] = "Make all edges directed";
$g_lang['save_svg_image'] = "Save graph to SVG";
$g_lang["bad_inc_pair_message"] = "Cannot create graph. Edge list has wrong format. Click \"fix\" button to fix edge list or \"help\" button to open help about format";
$g_lang["edge_list_wrong_format"] = "Edge list format is incorrect";
$g_lang["fix_button"] = "fix";
?>

View File

@ -11,6 +11,7 @@
$g_lang["menu_8"] = "Nyheter";
$g_lang["menu_9"] = "Följ exemplet";
$g_lang["menu_10"] = "Öppen källa";
$g_lang["menu_11"] = "Using edge list";
$g_lang["footer_info"] = "<a href=\"/\">Graf online</a> är att vertz för att skapa och visualisera en graf i två klick eller använda en grannmatris och hitta den kortaste sökvägen för anslutningsdelar som söker efter en Eulercykel. Dela med. Grafvisualisering och kortaste sökväg.";
$g_lang["lang"] = "Språk";
$g_lang["home"] = "Huvudsida";

View File

@ -846,6 +846,28 @@ Application.prototype.onPostLoadEvent = function()
wasLoad = true;
}
var pairs = document.getElementById("inputPair").innerHTML;
if (pairs.length > 0)
{
pairs = pairs.replaceAll('&gt;', '>');
pairs = pairs.replaceAll('&lt;', '<');
if (!this.SetPairSmart(pairs))
{
this.userAction("Pair.Failed");
this.ShowPairErrorDialog(pairs);
}
else
{
this.userAction("Pair.Success");
}
this.updateMessage();
this.redrawGraph();
wasLoad = true;
}
if (!wasLoad)
{
var graphName = this.getParameterByName("graph");
@ -933,6 +955,22 @@ Application.prototype.SetAdjacencyMatrix = function (matrix, separator)
return res;
}
Application.prototype.SetPair = function (pair)
{
var res = true;
var r = {};
var c = {};
if (!this.TestPair(pair))
{
$.get( "/" + SiteDir + "cgi-bin/addFailedMatrix.php?text=pair&matrix=" + encodeURIComponent(pair), function( data ) {;});
res = false;
}
this.graph.SetPair(pair, new Point(this.GetRealWidth(), this.GetRealHeight()), this.currentEnumVerticesType);
this.AutoAdjustViewport();
this.redrawGraph();
return res;
}
Application.prototype.GetIncidenceMatrix = function ()
{
@ -944,6 +982,11 @@ Application.prototype.TestIncidenceMatrix = function (matrix, rowsObj, colsObj)
return this.graph.TestIncidenceMatrix(matrix, rowsObj, colsObj);
}
Application.prototype.TestPair = function (pair)
{
return this.graph.TestPair(pair);
}
Application.prototype.SetIncidenceMatrix = function (matrix)
{
var res = true;
@ -1011,6 +1054,22 @@ Application.prototype.SetIncidenceMatrixSmart = function (matrix)
return res;
}
Application.prototype.SetPairSmart = function (pair)
{
var res = false;
if (this.TestPair(pair))
{
res = this.SetPair(pair);
}
else
{
res = false;
}
return res;
}
Application.prototype.SaveGraphOnDisk = function ()
{
@ -1288,6 +1347,34 @@ Application.prototype.ShowIncidenceMatrixErrorDialog = function(matrix)
buttons: dialogButtons,
});
}
Application.prototype.ShowPairErrorDialog = function(pair)
{
var dialogButtons = {};
pair = pair.replaceAll(/\n/g,'%0A');
pair = pair.replaceAll('>', '&gt;');
pair = pair.replaceAll('<', '&lt;');
dialogButtons[g_readMatrixHelp] = function() {
window.location.assign(g_language == "ru" ? "./wiki/Справка/СписокРебер" : "./wiki/Help/EdgeList");
};
dialogButtons[g_fix] = function() {
window.location.assign("./create_graph_by_edge_list?pair=" + pair);
};
dialogButtons[g_close] = function() {
$( this ).dialog( "close" );
};
$( "#pairErrorInc" ).dialog({
resizable: false,
title: g_pairWrongFormat,
width: 400,
modal: true,
dialogClass: 'EdgeDialog',
buttons: dialogButtons,
});
}
Application.prototype.SetFindPathReport = function (value)
{

View File

@ -38,6 +38,21 @@ Graph.prototype.AddNewVertex = function(vertex)
return this.vertices.length - 1;
}
Graph.prototype.ClearGraph = function() {
// List of vertex.
this.vertices = [];
// List of arcs.
this.edges = [];
// Unique Id of new graph.
this.uidGraph = 0;
// Unique Id of new edge.
this.uidEdge = 10000;
// Has direction edge.
this.hasDirect = false;
// Is graph multi
this.isMultiGraph = false;
}
Graph.prototype.AddNewEdgeSafe = function(graph1, graph2, isDirect, weight, replaceIfExists = true)
{
return this.AddNewEdge(new BaseEdge(graph1, graph2, isDirect, weight), replaceIfExists);
@ -138,6 +153,21 @@ Graph.prototype.FindVertex = function(id)
return res;
}
Graph.prototype.FindVertexByTitle = function(title)
{
var res = null;
for (var i = 0; i < this.vertices.length; i++)
{
if (this.vertices[i].mainText == title)
{
res = this.vertices[i];
break;
}
}
return res;
}
// deprecated
Graph.prototype.FindEdge = function(id1, id2)
{
@ -349,6 +379,43 @@ Graph.prototype.TestAdjacencyMatrix = function (matrix, rowsObj, colsObj, separa
return bGoodFormat;
}
Graph.prototype.TestPair = function (pair)
{
let lines = pair.split ("\n");
// Check:
// a - b
// a > b
// a < b
// a-(1)-b
// a-(1)>b
// a<(1)-b
let regExp = [
/^.+-.+$/g,
/^.+\>.+$/g,
/^.+<.+$/g,
/^.+-\(\d+\.?\d+\)-.+$/g,
/^.+-\(\d+\.?\d+\)\>.+$/g,
/^.+<\(\d+\.?\d+\)\-.+$/g
];
let res = true;
for (let i = 0; i < lines.length; ++i)
{
let resLine = false;
let line = lines[i];
if (line == "") {
continue;
}
for (let j = 0; j < regExp.length; ++j) {
if (line.match(regExp[j])) {
resLine = true;
}
}
res = resLine && res;
}
return res;
}
Graph.prototype.IsVerticesHaveSamePosition = function (position, vertexCount)
{
@ -366,6 +433,10 @@ Graph.prototype.IsVerticesHaveSamePosition = function (position, vertexCount)
return res;
}
Graph.prototype.GetRandomPosition = function (viewportSize) {
return new Point(Math.random() * viewportSize.x, Math.random() * viewportSize.y);
}
Graph.prototype.GetRandomPositionOfVertex = function (matrix, vertexIndex, viewportSize)
{
var point = new Point(0, 0);
@ -628,6 +699,88 @@ Graph.prototype.SetAdjacencyMatrix = function (matrix, viewportSize, currentEnum
}
}
Graph.prototype.SetPair = function (pairs, viewportSize, currentEnumVerticesType)
{
if (this.TestPair(pairs))
{
this.ClearGraph();
let lines = pairs.split ("\n");
// Extract:
// a - b
// a > b
// a < b
// a-(1)-b
// a-(1)>b
// a<(1)-b
let regExp = [
/^(.+)-(.+)$/g,
/^(.+)\>(.+)$/g,
/^(.+)<(.+)$/g,
/^(.+)-\((\d+|\d+\.?\d+)\)-(.+)$/g,
/^(.+)-\((\d+|\d+\.?\d+)\)\>(.+)$/g,
/^(.+)<\((\d+|\d+\.?\d+)\)\-(.+)$/g,
];
let bWeightGraph = false;
var newVertices = [];
for (var i = 0; i < lines.length; i++)
{
let line = lines[i];
if (line == "") {
continue;
}
for (let j = regExp.length - 1; j >= 0; --j) {
if (!line.match(regExp[j])) {
continue;
}
let groupes = Array.from(line.matchAll(regExp[j]));
let groupe = groupes[0];
let vetext1Title = groupe[1];
let vertex1 = this.FindVertexByTitle(vetext1Title);
if (vertex1 == null) {
let newPosition = this.GetRandomPosition(viewportSize);
vertex1 = this.vertices[this.AddNewVertex(new BaseVertex(newPosition.x, newPosition.y, currentEnumVerticesType))];
vertex1.mainText = vetext1Title;
newVertices.push(vertex1);
}
let vetext2Title = groupe[j <= 2 ? 2 : 3];
let vertex2 = this.FindVertexByTitle(vetext2Title);
if (vertex2 == null) {
let newPosition = this.GetRandomPosition(viewportSize);
vertex2 = this.vertices[this.AddNewVertex(new BaseVertex(newPosition.x, newPosition.y, currentEnumVerticesType))];
vertex2.mainText = vetext2Title;
newVertices.push(vertex2);
}
let isDirect = j == 1 || j == 2 || j == 4 || j == 5;
let weight = 1;
if (j > 2) {
weight = groupe[2];
bWeightGraph = true;
}
let isRevertEdge = j == 2 || j == 5;
let nEdgeIndex = this.AddNewEdgeSafe(isRevertEdge ? vertex2 : vertex1, isRevertEdge ? vertex1 : vertex2, isDirect, weight, false);
this.FixEdgeCurve(nEdgeIndex);
break;
}
}
// Set use weight false, because we have unweighted graph.
if (!bWeightGraph)
{
this.edges.forEach(function(part, index, theArray) {
theArray[index].useWeight = false;
});
}
this.VerticesReposition(viewportSize, newVertices);
}
}
Graph.prototype.TestIncidenceMatrix = function (matrix, rowsObj, colsObj, separator)
{

View File

@ -43,6 +43,8 @@ var g_write_to_us = "Write to us";
var g_fixMatrix = "Fix matrix";
var g_readMatrixHelp = "Matrix format help";
var g_matrixWrongFormat = "Matrix is wrong";
var g_pairWrongFormat = "Edge List is wrong";
var g_fix = "Fix"
var g_save_image_dialog = "Save graph image";
@ -395,4 +397,7 @@ function loadTexts()
g_reverseAllEdges = document.getElementById("reverseAllEdges").innerHTML;
g_makeAllUndirected = document.getElementById("makeAllUndirected").innerHTML;
g_makeAllDirected = document.getElementById("makeAllDirected").innerHTML;
g_pairWrongFormat = document.getElementById("pairWrongFormat").innerHTML;
g_fix = document.getElementById("fixButton").innerHTML;;
}

View File

@ -23,6 +23,9 @@
array(
"title" => L("menu_5"),
"link" => SiteRoot("create_graph_by_incidence_matrix"),),
array(
"title" => L("menu_11"),
"link" => SiteRoot("create_graph_by_edge_list"),),
array(
"title" => L("menu_9"),
"link" => SiteRoot("graphs_examples"),)

View File

@ -0,0 +1,76 @@
<head>
<link rel="stylesheet" type="text/css" href="<?= Root('i/css/create_graph_by_pair.css')?>" />
<script src="<?= Root('script/Graph.js')?>"></script>
</head>
<script>
function checkFormat()
{
var graph = new Graph();
if (!graph.TestPair($( "#PairFieldPage" ).val()))
{
$( "#BadFormatMessage" ).show();
}
else
{
$( "#BadFormatMessage" ).hide();
}
}
window.onload = function ()
{
if (document.getElementById('CreateByPair'))
{
document.getElementById('CreateByPair').onclick = function ()
{
$("#pairForm").submit();
}
}
$( "#PairFieldPage" ).on('keyup change', function (eventObject)
{
checkFormat();
});
checkFormat();
}
</script>
<h1><?= L('head_no_tags')?></h1>
<p><?= L('text')?></p>
<div>
<div id="message" class="alert alert-success" role="alert" style="height:64px">
<p id="TextDescription"><?= L('pair_description') ?></p>
</div>
<h4><?= L('edge_list') ?></h4>
<div class="row">
<div class="col-md-4">
<form action="./" method="post" id="pairForm">
<textarea name="pairs" id="PairFieldPage" wrap="off">
<?php if (!isset($_GET["pair"])): ?>
a-b
a-c
b-c
<?php else: ?>
<?= $_GET["pair"] ?>
<?php endif;?></textarea>
</form>
</div>
<div class="col-md-4">
<button type="button" class="btn btn-default btn-lg" id="CreateByPair"><span class="glyphicon glyphicon-ok"></span> <?= L('plot_graph_button')?></button>
<div id="BadFormatMessage" class="alert alert-warning" role="alert">
<?= L('pair_bad_format')?>
</div>
<div class="alert alert-info" role="alert">
<h4><?= L('ex_pair_format')?></h4>
<div>
<?= L('ex_pair_forma_description')?>
</div>
</div>
</div>
</div>
</div>

View File

@ -11,7 +11,7 @@
<script src="<?= Root('i/js/dev/jquery-ui.js')?>"></script>
<script src="<?= Root('i/js/dev/jquery.feedback_me.js')?>"></script>
<script src="<?= Root("script/canvas2svg.js")?>" ></script>
<script src="<?= Root("script/example.js?v=67")?>" ></script>
<script src="<?= Root("script/example.js?v=68")?>" ></script>
<!-- Yandex.RTB -->
<script>window.yaContextCb=window.yaContextCb||[]</script>
@ -445,6 +445,10 @@
<div id="matrixErrorInc" class="translation">
<div><span class="glyphicon glyphicon-remove-sign text-danger"></span> <?= L('bad_inc_matrix_message')?></div>
</div>
<div id="pairErrorInc" class="translation">
<div><span class="glyphicon glyphicon-remove-sign text-danger"></span> <?= L('bad_inc_pair_message')?></div>
</div>
<div id="voteDialog">
<form>
@ -721,6 +725,7 @@
<p id="inputMatrix" class="translation"><?= isset($_POST["matrix"]) ? $_POST["matrix"] : ""?></p>
<p id="separator" class="translation"><?= isset($_POST["separator"]) ? $_POST["separator"] : ""?></p>
<p id="inputIncidenceMatrix" class="translation"><?= isset($_POST["incidenceMatrix"]) ? $_POST["incidenceMatrix"] : ""?></p>
<p id="inputPair" class="translation"><?= isset($_POST["pairs"]) ? str_replace("<", "&lt;", str_replace(">", "&gt;", $_POST["pairs"])) : ""?></p>
<p id="currentLanguage" class="translation"><?= L('current_language')?></p>
<p id="editWeight" class="translation"><?= L('edit_weight')?></p>
<p id="noWeight" class="translation"><?= L('default_weight')?></p>
@ -850,6 +855,9 @@
<p id="makeAllUndirected" class="translation"><?= L('make_all_undirected')?></p>
<p id="makeAllDirected" class="translation"><?= L('make_all_directed')?></p>
<p id="pairWrongFormat" class="translation"><?= L('edge_list_wrong_format')?></p>
<p id="fixButton" class="translation"><?= L('fix_button')?></p>
</section>
<!--
<script>