Commit cf1ee6e3 authored by PkSM3's avatar PkSM3

again

parent 272d1947
This diff is collapsed.
asdasd 1. For dynamic graphs, remove html tag of "sigma-parent" and rebuild the subgraph
2. JS Pre-spatialization
3. New CSS
body{padding-top:50px}#banner{border-bottom:0}.page-header h1{font-size:4em}.bs-docs-section{margin-top:8em}.affix{top:70px}footer{margin:5em 0}footer li{float:left;margin-right:1.5em;margin-bottom:1.5em}footer p{margin-bottom:0;clear:left}.splash{padding:6em 0 2em;color:#fff;text-align:center;background:-webkit-linear-gradient(70deg,#080f1f 30%,#2b4b5a 87%,#435e67 100%);background:-o-linear-gradient(70deg,#080f1f 30%,#2b4b5a 87%,#435e67 100%);background:-ms-linear-gradient(70deg,#080f1f 30%,#2b4b5a 87%,#435e67 100%);background:-moz-linear-gradient(70deg,#080f1f 30%,#2b4b5a 87%,#435e67 100%);background:linear-gradient(20deg,#080f1f 30%,#2b4b5a 87%,#435e67 100%);background-attachment:fixed;background-color:#1c2533}.splash .alert{margin:4em 0 2em}.splash h1{font-size:4em}.splash #social{margin-top:6em}.section-tout{padding:4em 0 3em;background-color:#eaf1f1;border-top:1px solid rgba(255,255,255,0.1);border-bottom:1px solid rgba(0,0,0,0.1)}.section-tout [class^="icon-"]{margin-right:.5em}.section-tout p{margin-bottom:3em}.section-preview{padding:4em 0 4em}.section-preview .preview{margin-bottom:4em;background-color:#eaf1f1;border:1px solid rgba(0,0,0,0.1);border-radius:6px}.section-preview .preview .image{padding:5px}.section-preview .preview .image img{border:1px solid rgba(0,0,0,0.1)}.section-preview .preview .options{padding:0 2em 2em;text-align:center}.section-preview .preview .options p{margin-bottom:2em}.section-preview .dropdown-menu{text-align:left}.section-preview .lead{margin-bottom:2em}@media(max-width:767px){.section-preview .image img{width:100%}}.bsa .one .bsa_it_ad{background-color:transparent!important;border:none!important}.bsa .one .bsa_it_ad .bsa_it_t,.bsa .one .bsa_it_ad .bsa_it_d{color:inherit!important}.bsa .one .bsa_it_p{display:none}
$('[data-toggle="tooltip"]').tooltip();
\ No newline at end of file
(function(){
var bsa = document.createElement('script');
bsa.type = 'text/javascript';
bsa.async = true;
bsa.src = 'http://s3.buysellads.com/ac/bsa.js';
(document.getElementsByTagName('head')[0]||document.getElementsByTagName('body')[0]).appendChild(bsa);
})();
\ No newline at end of file
This diff is collapsed.
This diff is collapsed.
.navbar {
margin-bottom:1px;
}
#sigma-example {
width: 100%;
height: 300px;
position:relative;
float:right;
}
/*.btn-sm[normal] {*/
/* background-image: -webkit-linear-gradient(#5f8ab9, #3e648d 50%, #385a7f);*/
/* background-image: linear-gradient(#5f8ab9, #3e648d 50%, #385a7f);*/
/* background-repeat: no-repeat;*/
/* filter: progid:DXImageTransform.Microsoft.gradient(startColorstr='#ff5f8ab9', endColorstr='#ff385a7f', GradientType=0);*/
/* filter: none;*/
/* border: 1px solid #2e4b69;*/
/*}*/
#left{
display: inline-block;
}
/*.modal-vertical-centered {*/
#loader{
text-align:center;
transform: translate(0, 50%) !important;
-ms-transform: translate(0, 50%) !important; /*IE 9*/
-webkit-transform: translate(0, 50%) !important; /*Safari and Chrome */
}
#selectionsBox{
text-align:center;
background-color:white;
color:#250587;
margin: 7px;
border: 1px solid #666;
-moz-border-radius: 3px;
-webkit-border-radius: 3px;
-border-radius: 3px;
-moz-box-shadow: 0px 2px 6px #000;
-webkit-box-shadow: 0px 2px 6px #000;
box-shadow: 0px 2px 6px #000;
}
#opossitesBox{
margin: 7px;
padding: 10px 0px 10px 10px;
border-style:solid;
background-color:white;
color:black;
margin: 7px;
border: 1px solid #666;
-moz-border-radius: 3px;
-webkit-border-radius: 3px;
-border-radius: 3px;
-moz-box-shadow: 0px 2px 6px #000;
-webkit-box-shadow: 0px 2px 6px #000;
box-shadow: 0px 2px 6px #000;
}
#topPapers{
margin: 7px;
padding: 10px 0px 10px 10px;
border-style:solid;
background-color:white;
color:black;
margin: 7px;
border: 1px solid #666;
-moz-border-radius: 3px;
-webkit-border-radius: 3px;
-border-radius: 3px;
-moz-box-shadow: 0px 2px 6px #000;
-webkit-box-shadow: 0px 2px 6px #000;
box-shadow: 0px 2px 6px #000;
}
.grey {
color: #cccccc; font-style: italic;
}
/* ZOOM IN OUT */
#ctlzoom {
position: absolute; left: 5px; bottom: 5px; list-style: none; padding: 0; margin: 0;
}
#ctlzoom li {
padding: 0; margin: 10px 0; width: 36px; text-align: center;
}
#zoomSliderzone {
height: 120px;
}
#zoomMinusButton, #zoomPlusButton {
display: block; width: 24px; height: 24px; background:url("../tinawebJS/img/plusmoins.png"); margin: 0 auto;
}
#zoomMinusButton {
background-position: 0 -24px;
}
#zoomMinusButton:hover {
background-position: -24px -24px;
}
#zoomPlusButton {
background-position: 0 0;
}
#zoomPlusButton:hover {
background-position: -24px 0;
}
#lensButton {
display: block; width: 36px; height: 36px; background:url("../tinawebJS/img/loupe-edges2.png"); margin: 0 auto;
}
#lensButton {
background-position: -72px 0;
}
#lensButton:hover {
background-position: -36px 0;
}
#lensButton.off {
background-position: 0 0;
}
#lensButton.off:hover {
background-position: -108px 0;
}
#edgesButton {
display: block; width: 36px; height: 36px; background:url("../tinawebJS/img/loupe-edges.png"); margin: 0 auto;
}
#edgesButton {
background-position: -72px -36px;
}
#edgesButton:hover {
background-position: -36px -36px;
}
#edgesButton.off {
background-position: 0 -36px;
}
#edgesButton.off:hover {
background-position: -108px -36px;
}
#saveAs {
display: block; width: 30px; height: 30px; background:url("../tinawebJS/img/Save.png"); margin: 0 auto;
}
#zoomSlider {
background:#fff;
border:1px solid #aaa;
height: 120px; margin: 0 auto;
}
#showChat{
position: absolute; top: 16px; left: -14px; width: 20px; height: 100px; background: rgb(250, 250, 252); padding: 2px 2px 2px 0; border-top-right-radius: 5px; border-bottom-right-radius: 5px; box-shadow: 1px 1px 2px #808090;
}
#aShowChat {
float: left; width: 100%; height: 100%; background-image: url("../tinawebJS/img/chat.png");
}
/* GESTION DE LA BARRE DE GAUCHE */
#unfold {
position: absolute; top: 16px; right: -14px; width: 12px; height: 12px; background: rgb(250, 250, 252); padding: 2px 2px 2px 0; border-top-right-radius: 5px; border-bottom-right-radius: 5px; box-shadow: 1px 1px 2px #808090;
}
#aUnfold {
float: left; width: 12px; height: 12px; background-image: url("../tinawebJS/img/fleches-horiz.png");
}
.leftarrow {
background-position: -12px 0;
}
.rightarrow {
background-position: 0 0;
}
.leftarrow:hover {
background-position: -12px -12px;
}
.rightarrow:hover {
background-position: 0 -12px;
}
/* AUTOCOMPLETE */
#autocomplete {
position: absolute; display: none; padding: 0; margin: 0;
border-style: none solid; border-color: #ccc; border-width: 1px;
}
#autocomplete div {
border-bottom: 1px solid #ccc; padding: 0; margin: 0; float: left; clear: both; background: #fff;
}
#autocomplete h4 {
float: left; width: 80px; margin: 5px; font-size: 12px;
}
#autocomplete ul {
float: left; width: 240px; list-style: none; padding: 0; margin: 0;
}
#autocomplete li {
margin: 0; width: 240px; height: 28px; font-size: 12px; clear: both;
}
#autocomplete li a {
display: block; width: 240px; height: 28px; background: #fff; color: #06a8de;
}
#autocomplete li.hover a {
color: #fff; background: #06a8de;
}
#autocomplete span {
float: left; margin: 0; padding: 6px 2px 0;
}
#autocomplete img {
float: left; border: 0; width: 24px; height: 24px; margin: 2px 6px;
}
#cuerpo {
}
#leftcolumn {
margin-left: -210px;
margin-right: 0px;
left: 210px;
width: 210px;
background: url(../img/climpek.png) repeat;
position: fixed;
height: 100%;
border: 1px #888888 solid;
-moz-box-shadow: 0px 0px 3px 0px #888888;
-webkit-box-shadow: 0px 0px 3px 0px #888888;
box-shadow: 0px 0px 3px 0px #888888;
overflow-y: auto;
z-index: 1000;
transition: all 0.4s ease 0s;
}
#page-content-wrapper {
width: 100%;
}
This diff is collapsed.
<!DOCTYPE html>
<html lang="en">
<head>
<meta http-equiv="content-type" content="text/html; charset=UTF-8">
</head>
<body>
<div id="sigma-hola"></div>
<script src="libs/jquery/jquery-1.9.1.js"></script>
<script src="libs/jquery/jquery-ui.js" type="text/javascript"></script>
<script src="libs/jquery/jquery.ba-dotimeout.min.js" type="text/javascript"></script>
<script src="tinawebJS/js/sigma.min.js" type="text/javascript"></script>
lalalaalal<br>
<div id="log"></div>
<script src="FA2.js"></script>
<script src="genesis.js"></script>
</body>
</html>
function pr(msg){
console.log(msg);
}
var counter=0;
$( window ).resize(function() {
counter++;
$("#log").html("redimension numero: "+counter);
});
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This source diff could not be displayed because it is too large. You can view the blob instead.
/* =========================================================
* bootstrap-modal.js v2.0.2
* http://twitter.github.com/bootstrap/javascript.html#modals
* =========================================================
* Copyright 2012 Twitter, Inc.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
* ========================================================= */
!function( $ ){
"use strict"
/* MODAL CLASS DEFINITION
* ====================== */
var Modal = function ( content, options ) {
this.options = options
this.$element = $(content)
.delegate('[data-dismiss="modal"]', 'click.dismiss.modal', $.proxy(this.hide, this))
}
Modal.prototype = {
constructor: Modal
, toggle: function () {
return this[!this.isShown ? 'show' : 'hide']()
}
, show: function () {
var that = this
if (this.isShown) return
$('body').addClass('modal-open')
this.isShown = true
this.$element.trigger('show')
escape.call(this)
backdrop.call(this, function () {
var transition = $.support.transition && that.$element.hasClass('fade')
!that.$element.parent().length && that.$element.appendTo(document.body) //don't move modals dom position
that.$element
.show()
if (transition) {
that.$element[0].offsetWidth // force reflow
}
that.$element.addClass('in')
transition ?
that.$element.one($.support.transition.end, function () { that.$element.trigger('shown') }) :
that.$element.trigger('shown')
})
}
, hide: function ( e ) {
e && e.preventDefault()
if (!this.isShown) return
var that = this
this.isShown = false
$('body').removeClass('modal-open')
escape.call(this)
this.$element
.trigger('hide')
.removeClass('in')
$.support.transition && this.$element.hasClass('fade') ?
hideWithTransition.call(this) :
hideModal.call(this)
}
}
/* MODAL PRIVATE METHODS
* ===================== */
function hideWithTransition() {
var that = this
, timeout = setTimeout(function () {
that.$element.off($.support.transition.end)
hideModal.call(that)
}, 500)
this.$element.one($.support.transition.end, function () {
clearTimeout(timeout)
hideModal.call(that)
})
}
function hideModal( that ) {
this.$element
.hide()
.trigger('hidden')
backdrop.call(this)
}
function backdrop( callback ) {
var that = this
, animate = this.$element.hasClass('fade') ? 'fade' : ''
if (this.isShown && this.options.backdrop) {
var doAnimate = $.support.transition && animate
this.$backdrop = $('<div class="modal-backdrop ' + animate + '" />')
.appendTo(document.body)
if (this.options.backdrop != 'static') {
this.$backdrop.click($.proxy(this.hide, this))
}
if (doAnimate) this.$backdrop[0].offsetWidth // force reflow
this.$backdrop.addClass('in')
doAnimate ?
this.$backdrop.one($.support.transition.end, callback) :
callback()
} else if (!this.isShown && this.$backdrop) {
this.$backdrop.removeClass('in')
$.support.transition && this.$element.hasClass('fade')?
this.$backdrop.one($.support.transition.end, $.proxy(removeBackdrop, this)) :
removeBackdrop.call(this)
} else if (callback) {
callback()
}
}
function removeBackdrop() {
this.$backdrop.remove()
this.$backdrop = null
}
function escape() {
var that = this
if (this.isShown && this.options.keyboard) {
$(document).on('keyup.dismiss.modal', function ( e ) {
e.which == 27 && that.hide()
})
} else if (!this.isShown) {
$(document).off('keyup.dismiss.modal')
}
}
/* MODAL PLUGIN DEFINITION
* ======================= */
$.fn.modal = function ( option ) {
return this.each(function () {
var $this = $(this)
, data = $this.data('modal')
, options = $.extend({}, $.fn.modal.defaults, $this.data(), typeof option == 'object' && option)
if (!data) $this.data('modal', (data = new Modal(this, options)))
if (typeof option == 'string') data[option]()
else if (options.show) data.show()
})
}
$.fn.modal.defaults = {
backdrop: true
, keyboard: true
, show: true
}
$.fn.modal.Constructor = Modal
/* MODAL DATA-API
* ============== */
$(function () {
$('body').on('click.modal.data-api', '[data-toggle="modal"]', function ( e ) {
var $this = $(this), href
, $target = $($this.attr('data-target') || (href = $this.attr('href')) && href.replace(/.*(?=#[^\s]+$)/, '')) //strip for ie7
, option = $target.data('modal') ? 'toggle' : $.extend({}, $target.data(), $this.data())
e.preventDefault()
$target.modal(option)
})
})
}( window.jQuery );
\ No newline at end of file
/* ===================================================
* bootstrap-transition.js v2.0.2
* http://twitter.github.com/bootstrap/javascript.html#transitions
* ===================================================
* Copyright 2012 Twitter, Inc.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
* ========================================================== */
!function( $ ) {
$(function () {
"use strict"
/* CSS TRANSITION SUPPORT (https://gist.github.com/373874)
* ======================================================= */
$.support.transition = (function () {
var thisBody = document.body || document.documentElement
, thisStyle = thisBody.style
, support = thisStyle.transition !== undefined || thisStyle.WebkitTransition !== undefined || thisStyle.MozTransition !== undefined || thisStyle.MsTransition !== undefined || thisStyle.OTransition !== undefined
return support && {
end: (function () {
var transitionEnd = "TransitionEnd"
// if ( $.browser.webkit ) {
// transitionEnd = "webkitTransitionEnd"
// } else if ( $.browser.mozilla ) {
// transitionEnd = "transitionend"
// } else if ( $.browser.opera ) {
// transitionEnd = "oTransitionEnd"
// }
return transitionEnd
}())
}
})()
})
}( window.jQuery );
\ No newline at end of file
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
jQuery UI Authors (http://jqueryui.com/about)
This software consists of voluntary contributions made by many
individuals. For exact contribution history, see the revision history
and logs, available at http://github.com/jquery/jquery-ui
Brandon Aaron
Paul Bakaus (paulbakaus.com)
David Bolter
Rich Caloggero
Chi Cheng (cloudream@gmail.com)
Colin Clark (http://colin.atrc.utoronto.ca/)
Michelle D'Souza
Aaron Eisenberger (aaronchi@gmail.com)
Ariel Flesler
Bohdan Ganicky
Scott González
Marc Grabanski (m@marcgrabanski.com)
Klaus Hartl (stilbuero.de)
Scott Jehl
Cody Lindley
Eduardo Lundgren (eduardolundgren@gmail.com)
Todd Parker
John Resig
Patty Toland
Ca-Phun Ung (yelotofu.com)
Keith Wood (kbwood@virginbroadband.com.au)
Maggie Costello Wachs
Richard D. Worth (rdworth.org)
Jörn Zaefferer (bassistance.de)
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
/*
* jQuery doTimeout: Like setTimeout, but better! - v1.0 - 3/3/2010
* http://benalman.com/projects/jquery-dotimeout-plugin/
*
* Copyright (c) 2010 "Cowboy" Ben Alman
* Dual licensed under the MIT and GPL licenses.
* http://benalman.com/about/license/
*/
(function($){var a={},c="doTimeout",d=Array.prototype.slice;$[c]=function(){return b.apply(window,[0].concat(d.call(arguments)))};$.fn[c]=function(){var f=d.call(arguments),e=b.apply(this,[c+f[0]].concat(f));return typeof f[0]==="number"||typeof f[1]==="number"?this:e};function b(l){var m=this,h,k={},g=l?$.fn:$,n=arguments,i=4,f=n[1],j=n[2],p=n[3];if(typeof f!=="string"){i--;f=l=0;j=n[1];p=n[2]}if(l){h=m.eq(0);h.data(l,k=h.data(l)||{})}else{if(f){k=a[f]||(a[f]={})}}k.id&&clearTimeout(k.id);delete k.id;function e(){if(l){h.removeData(l)}else{if(f){delete a[f]}}}function o(){k.id=setTimeout(function(){k.fn()},j)}if(p){k.fn=function(q){if(typeof p==="string"){p=g[p]}p.apply(m,d.call(n,i))===true&&!q?o():e()};o()}else{if(k.fn){j===undefined?e():k.fn(j===false);return true}else{e()}}}})(jQuery);
\ No newline at end of file
/*
DynaCloud v5
A dynamic JavaScript tag/keyword cloud with jQuery.
<http://johannburkard.de/blog/programming/javascript/dynacloud-a-dynamic-javascript-tag-keyword-cloud-with-jquery.html>
MIT license.
Johann Burkard
<http://johannburkard.de>
<mailto:jb@eaio.com>
*/
jQuery.fn.highlight = function(pat) {
function innerHighlight(node, pat) {
var skip = 0;
if (node.nodeType == 3) {
var pos = node.data.toUpperCase().indexOf(pat);
if (pos >= 0) {
var spannode = document.createElement('span');
spannode.className = 'highlight';
var middlebit = node.splitText(pos);
var endbit = middlebit.splitText(pat.length);
var middleclone = middlebit.cloneNode(true);
spannode.appendChild(middleclone);
middlebit.parentNode.replaceChild(spannode, middlebit);
skip = 1;
}
}
else if (node.nodeType == 1 && node.childNodes && !/(script|style)/i.test(node.tagName)) {
for (var i = 0; i < node.childNodes.length; ++i) {
i += innerHighlight(node.childNodes[i], pat);
}
}
return skip;
}
return this.each(function() {
innerHighlight(this, pat.toUpperCase());
});
};
jQuery.fn.removeHighlight = function() {
return this.find("span.highlight").each(function() {
this.parentNode.firstChild.nodeName;
with (this.parentNode) {
replaceChild(this.firstChild, this);
normalize();
}
}).end();
};
jQuery.dynaCloud = {
max: 20,
sort: true,
auto: true,
single: true,
wordStats: true,
scale: 4,
// Adapted from <http://www.perseus.tufts.edu/Texts/engstop.html>
stopwords: [ "a", "about", "above", "accordingly", "after",
"again", "against", "ah", "all", "also", "although", "always", "am", "among", "amongst", "an",
"and", "any", "anymore", "anyone", "are", "as", "at", "away", "be", "been",
"begin", "beginning", "beginnings", "begins", "begone", "begun", "being",
"below", "between", "but", "by", "ca", "can", "cannot", "come", "could",
"did", "do", "doing", "during", "each", "either", "else", "end", "et",
"etc", "even", "ever", "far", "ff", "following", "for", "from", "further", "furthermore",
"get", "go", "goes", "going", "got", "had", "has", "have", "he", "her",
"hers", "herself", "him", "himself", "his", "how", "i", "if", "in", "into",
"is", "it", "its", "itself", "last", "lastly", "less", "many", "may", "me",
"might", "more", "must", "my", "myself", "near", "nearly", "never", "new",
"next", "no", "not", "now", "o", "of", "off", "often", "oh", "on", "only",
"or", "other", "otherwise", "our", "ourselves", "out", "over", "perhaps",
"put", "puts", "quite", "s", "said", "saw", "say", "see", "seen", "shall",
"she", "should", "since", "so", "some", "such", "t", "than", "that", "the",
"their", "them", "themselves", "then", "there", "therefore", "these", "they",
"this", "those", "though", "throughout", "thus", "to", "too",
"toward", "unless", "until", "up", "upon", "us", "ve", "very", "was", "we",
"were", "what", "whatever", "when", "where", "which", "while", "who",
"whom", "whomever", "whose", "why", "with", "within", "without", "would",
"yes", "your", "yours", "yourself", "yourselves" ]
};
jQuery(function() {
jQuery.dynaCloud.stopwords = new RegExp("\\s((" + jQuery.dynaCloud.stopwords.join("|") + ")\\s)+", "gi");
if (jQuery.dynaCloud.auto) {
jQuery('.dynacloud').dynaCloud();
}
});
jQuery.fn.dynaCloud = function(outElement) {
var cloud = {};
return this.each(function() {
var cl = [];
var max = 0;
if (jQuery.wordStats && jQuery.dynaCloud.wordStats) {
jQuery.wordStats.computeTopWords(jQuery.dynaCloud.max, this);
for (var i = 0, j = jQuery.wordStats.topWords.length; i < j && i <= jQuery.dynaCloud.max; ++i) {
var t = jQuery.wordStats.topWords[i].substring(1);
if (typeof cloud[t] == 'undefined') {
cloud[t] = { count: jQuery.wordStats.topWeights[i], el: t };
}
else {
cloud[t].count += jQuery.wordStats.topWeights[i];
}
max = Math.max(cloud[t].count, max);
}
jQuery.wordStats.clear();
}
else {
var elems = jQuery(this).text().replace(/[^A-Z\xC4\xD6\xDCa-z\xE4\xF6\xFC\xDF0-9_]/g, ' ').replace(jQuery.dynaCloud.stopwords, ' ').split(' ');
var word = /^[a-z\xE4\xF6\xFC]*[A-Z\xC4\xD6\xDC]([A-Z\xC4\xD6\xDC\xDF]+|[a-z\xE4\xF6\xFC\xDF]{3,})/;
jQuery.each(elems, function(i, n) {
if (word.test(n)) {
var t = n.toLowerCase();
if (typeof cloud[t] == 'undefined') {
cloud[t] = { count: 1, el: n };
}
else {
cloud[t].count += 1;
}
max = Math.max(cloud[t].count, max);
}
});
}
jQuery.each(cloud, function(i, n) {
cl[cl.length] = n;
});
if (jQuery.dynaCloud.sort) {
cl.sort(function(a, b) {
if (a.count == b.count) {
return a.el < b.el ? -1 : (a.el == b.el ? 0 : 1);
}
else {
return a.count < b.count ? 1 : -1;
}
});
}
var out;
if ((out = jQuery(outElement ? outElement : '#dynacloud')).length == 0) {
jQuery(document.body).append('<p id="dynacloud"><\/p>');
out = jQuery('#dynacloud');
}
out.empty();
var l = jQuery.dynaCloud.max == -1 ? cl.length : Math.min(jQuery.dynaCloud.max, cl.length);
for (var i = 0; i < l; ++i) {
out.append('<a href="#' + cl[i].el + '" style="font-size: ' + Math.ceil((cl[i].count / max) * jQuery.dynaCloud.scale) + 'em"><span>' + cl[i].el + '</span></a> &nbsp; ');
}
var target = this;
jQuery('a', out).each(function() {
jQuery(this).click(function() {
if (jQuery.dynaCloud.single) {
jQuery(document.body).removeHighlight();
}
var text = jQuery(this).text().toUpperCase();
jQuery(target).each(function() {
jQuery(this).highlight(text);
});
return false;
});
});
});
};
/*
highlight v3
Highlights arbitrary terms.
<http://johannburkard.de/blog/programming/javascript/highlight-javascript-text-higlighting-jquery-plugin.html>
MIT license.
Johann Burkard
<http://johannburkard.de>
<mailto:jb@eaio.com>
*/
jQuery.fn.highlight = function(pat) {
function innerHighlight(node, pat) {
var skip = 0;
if (node.nodeType == 3) {
var pos = node.data.toUpperCase().indexOf(pat);
if (pos >= 0) {
var spannode = document.createElement('span');
spannode.className = 'highlight';
var middlebit = node.splitText(pos);
var endbit = middlebit.splitText(pat.length);
var middleclone = middlebit.cloneNode(true);
spannode.appendChild(middleclone);
middlebit.parentNode.replaceChild(spannode, middlebit);
skip = 1;
}
}
else if (node.nodeType == 1 && node.childNodes && !/(script|style)/i.test(node.tagName)) {
for (var i = 0; i < node.childNodes.length; ++i) {
i += innerHighlight(node.childNodes[i], pat);
}
}
return skip;
}
return this.each(function() {
innerHighlight(this, pat.toUpperCase());
});
};
jQuery.fn.removeHighlight = function() {
return this.find("span.highlight").each(function() {
this.parentNode.firstChild.nodeName;
with (this.parentNode) {
replaceChild(this.firstChild, this);
normalize();
}
}).end();
};
(function($){$.toJSON=function(o)
{if(typeof(JSON)=='object'&&JSON.stringify)
return JSON.stringify(o);var type=typeof(o);if(o===null)
return"null";if(type=="undefined")
return undefined;if(type=="number"||type=="boolean")
return o+"";if(type=="string")
return $.quoteString(o);if(type=='object')
{if(typeof o.toJSON=="function")
return $.toJSON(o.toJSON());if(o.constructor===Date)
{var month=o.getUTCMonth()+1;if(month<10)month='0'+month;var day=o.getUTCDate();if(day<10)day='0'+day;var year=o.getUTCFullYear();var hours=o.getUTCHours();if(hours<10)hours='0'+hours;var minutes=o.getUTCMinutes();if(minutes<10)minutes='0'+minutes;var seconds=o.getUTCSeconds();if(seconds<10)seconds='0'+seconds;var milli=o.getUTCMilliseconds();if(milli<100)milli='0'+milli;if(milli<10)milli='0'+milli;return'"'+year+'-'+month+'-'+day+'T'+
hours+':'+minutes+':'+seconds+'.'+milli+'Z"';}
if(o.constructor===Array)
{var ret=[];for(var i=0;i<o.length;i++)
ret.push($.toJSON(o[i])||"null");return"["+ret.join(",")+"]";}
var pairs=[];for(var k in o){var name;var type=typeof k;if(type=="number")
name='"'+k+'"';else if(type=="string")
name=$.quoteString(k);else
continue;if(typeof o[k]=="function")
continue;var val=$.toJSON(o[k]);pairs.push(name+":"+val);}
return"{"+pairs.join(", ")+"}";}};$.evalJSON=function(src)
{if(typeof(JSON)=='object'&&JSON.parse)
return JSON.parse(src);return eval("("+src+")");};$.secureEvalJSON=function(src)
{if(typeof(JSON)=='object'&&JSON.parse)
return JSON.parse(src);var filtered=src;filtered=filtered.replace(/\\["\\\/bfnrtu]/g,'@');filtered=filtered.replace(/"[^"\\\n\r]*"|true|false|null|-?\d+(?:\.\d*)?(?:[eE][+\-]?\d+)?/g,']');filtered=filtered.replace(/(?:^|:|,)(?:\s*\[)+/g,'');if(/^[\],:{}\s]*$/.test(filtered))
return eval("("+src+")");else
throw new SyntaxError("Error parsing JSON, source is not valid.");};$.quoteString=function(string)
{if(string.match(_escapeable))
{return'"'+string.replace(_escapeable,function(a)
{var c=_meta[a];if(typeof c==='string')return c;c=a.charCodeAt();return'\\u00'+Math.floor(c/16).toString(16)+(c%16).toString(16);})+'"';}
return'"'+string+'"';};var _escapeable=/["\\\x00-\x1f\x7f-\x9f]/g;var _meta={'\b':'\\b','\t':'\\t','\n':'\\n','\f':'\\f','\r':'\\r','"':'\\"','\\':'\\\\'};})(jQuery);
\ No newline at end of file
/*! Copyright (c) 2011 Brandon Aaron (http://brandonaaron.net)
* Licensed under the MIT License (LICENSE.txt).
*
* Thanks to: http://adomas.org/javascript-mouse-wheel/ for some pointers.
* Thanks to: Mathias Bank(http://www.mathias-bank.de) for a scope bug fix.
* Thanks to: Seamus Leahy for adding deltaX and deltaY
*
* Version: 3.0.6
*
* Requires: 1.2.2+
*/
(function(a){
function d(b){
var c=b||window.event,d=[].slice.call(arguments,1),e=0,f=!0,g=0,h=0;
return b=a.event.fix(c),b.type="mousewheel",c.wheelDelta&&(e=c.wheelDelta/120),c.detail&&(e=-c.detail/3),h=e,c.axis!==undefined&&c.axis===c.HORIZONTAL_AXIS&&(h=0,g=-1*e),c.wheelDeltaY!==undefined&&(h=c.wheelDeltaY/120),c.wheelDeltaX!==undefined&&(g=-1*c.wheelDeltaX/120),d.unshift(b,e,g,h),(a.event.dispatch||a.event.handle).apply(this,d)
}
var b=["DOMMouseScroll","mousewheel"];
if(a.event.fixHooks)for(var c=b.length;c;)a.event.fixHooks[b[--c]]=a.event.mouseHooks;
a.event.special.mousewheel={
setup:function(){
if(this.addEventListener)for(var a=b.length;a;)this.addEventListener(b[--a],d,!1);else this.onmousewheel=d
},
teardown:function(){
if(this.removeEventListener)for(var a=b.length;a;)this.removeEventListener(b[--a],d,!1);else this.onmousewheel=null
}
},a.fn.extend({
mousewheel:function(a){
return a?this.bind("mousewheel",a):this.trigger("mousewheel")
},
unmousewheel:function(a){
return this.unbind("mousewheel",a)
}
})
})(jQuery)
/*
* jQuery nap 1.0.0
* www.frebsite.nl
* Copyright (c) 2010 Fred Heusschen
* Licensed under the MIT license.
* http://www.opensource.org/licenses/mit-license.php
*/
(function($) {
$.fn.nap = function(fallAsleep, wakeUp, standbyTime) {
if (typeof(standbyTime) == 'number' && standbyTime > 0) {
$.fn.nap.standbyTime = standbyTime;
if ($.fn.nap.readySetGo) {
$.fn.nap.pressSnooze();
}
}
if (!$.fn.nap.readySetGo) {
$.fn.nap.readySetGo = true;
$(window).mousemove(function() {
$.fn.nap.interaction();
});
$(window).keyup(function() {
$.fn.nap.interaction();
});
$(window).mousedown(function() {
$.fn.nap.interaction();
});
$(window).scroll(function() {
$.fn.nap.interaction();
});
$.fn.nap.pressSnooze();
}
return this.each(function() {
$.fn.nap.fallAsleepFunctions.push({
func: fallAsleep,
napr: $(this)
});
$.fn.nap.wakeUpFunctions.push({
func: wakeUp,
napr: $(this)
});
});
}
$.fn.nap.standbyTime = 60;
$.fn.nap.isAwake = true;
$.fn.nap.readySetGo = false;
$.fn.nap.fallAsleepFunctions = new Array();
$.fn.nap.wakeUpFunctions = new Array();
$.fn.nap.fallAsleep = function() {
$.fn.nap.isAwake = false;
clearInterval($.fn.nap.alarmClock);
$.fn.nap.callFunctions($.fn.nap.fallAsleepFunctions);
};
$.fn.nap.wakeUp = function() {
$.fn.nap.isAwake = true;
$.fn.nap.callFunctions($.fn.nap.wakeUpFunctions);
};
$.fn.nap.pressSnooze = function() {
clearInterval($.fn.nap.alarmClock);
$.fn.nap.alarmClock = setInterval(function() {
$.fn.nap.fallAsleep();
}, $.fn.nap.standbyTime * 1000);
}
$.fn.nap.interaction = function() {
if (!$.fn.nap.isAwake) {
$.fn.nap.wakeUp();
}
$.fn.nap.pressSnooze();
}
$.fn.nap.callFunctions = function(f) {
for (var i in f) {
if (typeof(f[i].func) == 'function') {
f[i].func();
} else if (typeof(f[i].func) == 'string' && f[i].func.length > 0) {
f[i].napr.trigger(f[i].func);
} else if (typeof(f[i].func) == 'object') {
for (var z in f[i].func) {
f[i].napr.trigger(f[i].func[z]);
}
}
}
}
})(jQuery);
\ No newline at end of file
/*
* jQuery Notify UI Widget 1.4
* Copyright (c) 2010 Eric Hynds
*
* http://www.erichynds.com/jquery/a-jquery-ui-growl-ubuntu-notification-widget/
*
* Depends:
* - jQuery 1.4
* - jQuery UI 1.8 widget factory
*
* Dual licensed under the MIT and GPL licenses:
* http://www.opensource.org/licenses/mit-license.php
* http://www.gnu.org/licenses/gpl.html
*
*/
(function(d){d.widget("ech.notify",{options:{speed:500,expires:5E3,stack:"below",custom:false},_create:function(){var a=this;this.templates={};this.keys=[];this.element.addClass("ui-notify").children().addClass("ui-notify-message ui-notify-message-style").each(function(b){b=this.id||b;a.keys.push(b);a.templates[b]=d(this).removeAttr("id").wrap("<div></div>").parent().html()}).end().empty().show()},create:function(a,b,c){if(typeof a==="object"){c=b;b=a;a=null}a=this.templates[a||this.keys[0]];if(c&&c.custom)a=d(a).removeClass("ui-notify-message-style").wrap("<div></div>").parent().html();return(new d.ech.notify.instance(this))._create(b,d.extend({},this.options,c),a)}});d.extend(d.ech.notify,{instance:function(a){this.parent=a;this.isOpen=false}});d.extend(d.ech.notify.instance.prototype,{_create:function(a,b,c){this.options=b;var e=this;c=c.replace(/#(?:\{|%7B)(.*?)(?:\}|%7D)/g,function(f,g){return g in a?a[g]:""});c=this.element=d(c);var h=c.find(".ui-notify-close");typeof this.options.click==="function"&&c.addClass("ui-notify-click").bind("click",function(f){e._trigger("click",f,e)});h.length&&h.bind("click",function(){e.close();return false});this.open();typeof b.expires==="number"&&window.setTimeout(function(){e.close()},b.expires);return this},close:function(){var a=this,b=this.options.speed;this.isOpen=false;this.element.fadeTo(b,0).slideUp(b,function(){a._trigger("close")});return this},open:function(){if(this.isOpen||this._trigger("beforeopen")===false)return this;var a=this;this.isOpen=true;this.element[this.options.stack==="above"?"prependTo":"appendTo"](this.parent.element).css({display:"none",opacity:""}).fadeIn(this.options.speed,function(){a._trigger("open")});return this},widget:function(){return this.element},_trigger:function(a,b,c){return this.parent._trigger.call(this,a,b,c)}})})(jQuery);
This diff is collapsed.
This diff is collapsed.
/*
* vertical news ticker
* Tadas Juozapaitis ( kasp3rito@gmail.com )
* http://plugins.jquery.com/project/vTicker
*/
(function(a){a.fn.vTicker=function(b){var c={speed:700,pause:4000,showItems:3,animation:"",mousePause:true,isPaused:false,direction:"up",height:0};var b=a.extend(c,b);moveUp=function(g,d,e){if(e.isPaused){return}var f=g.children("ul");var h=f.children("li:first").clone(true);if(e.height>0){d=f.children("li:first").height()}f.animate({top:"-="+d+"px"},e.speed,function(){a(this).children("li:first").remove();a(this).css("top","0px")});if(e.animation=="fade"){f.children("li:first").fadeOut(e.speed);if(e.height==0){f.children("li:eq("+e.showItems+")").hide().fadeIn(e.speed)}}h.appendTo(f)};moveDown=function(g,d,e){if(e.isPaused){return}var f=g.children("ul");var h=f.children("li:last").clone(true);if(e.height>0){d=f.children("li:first").height()}f.css("top","-"+d+"px").prepend(h);f.animate({top:0},e.speed,function(){a(this).children("li:last").remove()});if(e.animation=="fade"){if(e.height==0){f.children("li:eq("+e.showItems+")").fadeOut(e.speed)}f.children("li:first").hide().fadeIn(e.speed)}};return this.each(function(){var f=a(this);var e=0;f.css({overflow:"hidden",position:"relative"}).children("ul").css({position:"absolute",margin:0,padding:0}).children("li").css({margin:0,padding:0});if(b.height==0){f.children("ul").children("li").each(function(){if(a(this).height()>e){e=a(this).height()}});f.children("ul").children("li").each(function(){a(this).height(e)});f.height(e*b.showItems)}else{f.height(b.height)}var d=setInterval(function(){if(b.direction=="up"){moveUp(f,e,b)}else{moveDown(f,e,b)}},b.pause);if(b.mousePause){f.bind("mouseenter",function(){b.isPaused=true}).bind("mouseleave",function(){b.isPaused=false})}})}})(jQuery);
\ No newline at end of file
from Region import Region
import ForceFactory
import math
import random
import sys
import pprint
class ForceAtlas2:
def __init__(self,graph):
self.graph = graph
self.nodesIndex = {}
self.p={
"linLogMode": False,
"outboundAttractionDistribution": False,
"adjustSizes": False,
"edgeWeightInfluence": 0,
"scalingRatio": 1,
"strongGravityMode": False,
"gravity": 1,
"jitterTolerance": 1,
"barnesHutOptimize": False,
"barnesHutTheta": 1.2,
"speed": 1,
"outboundAttCompensation": 1,
"totalSwinging": 0,
"swingVSnode1": 0,
"totalEffectiveTraction": 0,
"complexIntervals": 500,
"simpleIntervals": 1000
}
self.state = {"step": 0, "index": 0}
self.rootRegion = 0
def init(self):
self.setAutoSettings()
nds = self.graph["nodes"]
for i in range(len(nds)):
if not nds[i].has_key("fixed"):
nds[i]['fixed'] = False
if not nds[i].has_key("x"):
nds[i]['x'] = random.uniform(0,1)
if not nds[i].has_key("y"):
nds[i]['y'] = random.uniform(0,1)
self.nodesIndex[nds[i]['id']] = i
nds[i]["fa2"] = {
"mass": 1+nds[i]["degree"],
"old_dx": 0,
"old_dy": 0,
"dx": 0,
"dy": 0
}
return self
def go(self):
while (self.atomicGo()):
print "something"
def printNodesFA2(self):
for i in self.graph["nodes"]:
print i
def setAutoSettings(self):
# Tuning
lenNodes = len(self.graph["nodes"])
if (lenNodes >= 100):
self.p["scalingRatio"] = 2.0
else:
self.p["scalingRatio"] = 10.0
self.p["strongGravityMode"] = False
self.p["gravity"] = 1
# Behavior
self.p["outboundAttractionDistribution"] = False
self.p["linLogMode"] = False
self.p["adjustSizes"] = False
self.p["edgeWeightInfluence"] = 1
# Performance
if (lenNodes >= 50000):
self.p["jitterTolerance"] = 10
elif (lenNodes >= 5000):
self.p["jitterTolerance"] = 1
else:
self.p["jitterTolerance"] = 0.1
if (lenNodes >= 1000):
self.p["barnesHutOptimize"] = True
else:
self.p["barnesHutOptimize"] = False
self.p["barnesHutTheta"] = 1.2
def atomicGo(self):
graph = self.graph
nodes = graph["nodes"]
edges = graph["edges"]
cInt = self.p["complexIntervals"]
sInt = self.p["simpleIntervals"]
case = self.state["step"]
if case==0:
# Initialise layout data
print "the case 0"
for i in range(len(nodes)):
if nodes[i]["fa2"]:
nodes[i]["fa2"]["mass"] = 1 + nodes[i]["degree"]
nodes[i]["fa2"]["old_dx"] = nodes[i]["fa2"]["dx"]
nodes[i]["fa2"]["old_dy"] = nodes[i]["fa2"]["dy"]
nodes[i]["fa2"]["dx"] = 0
nodes[i]["fa2"]["dy"] = 0
else:
nodes[i]["fa2"] = {
"mass": 1 + nodes[i]["degree"],
"old_dx": 0,
"old_dy": 0,
"dx": 0,
"dy": 0
}
# If Barnes Hut active, initialize root region
if self.p["barnesHutOptimize"]:
print '\tcase 0 -> ["barnesHutOptimize"]'
self.rootRegion = Region(nodes, 0)
self.rootRegion.buildSubRegions()
# If outboundAttractionDistribution active, compensate.
if self.p["outboundAttractionDistribution"]:
print '\tcase 0 -> ["outboundAttractionDistribution"]'
self.p["outboundAttCompensation"] = 0
for i in range(len(nodes)):
self.p["outboundAttCompensation"] += nodes[i]["fa2"]["mass"]
self.p["outboundAttCompensation"] /= len(nodes)
self.state["step"] = 1
self.state["index"] = 0
return True
elif case==1:
# Repulsion
print "the case 1: Repulsion"
Repulsion = ForceFactory.buildRepulsion(self.p["adjustSizes"],self.p["scalingRatio"])
print "\tprinting what it is inside of Repulsion variable"
print Repulsion
if self.p["barnesHutOptimize"]:
rootRegion = self.rootRegion
barnesHutTheta = self.p["barnesHutTheta"]
i = self.state["index"]
while (i < len(nodes) and i < self.state["index"] + cInt):
n = nodes[i]
i+=1
if n["fa2"]:
rootRegion.applyForce(n, Repulsion, barnesHutTheta)
if (i == len(nodes)):
self.state["step"] = 2
self.state["index"] = 0
else:
self.state["index"] = i
else:
i1 = self.state["index"]
while (i1 < len(nodes) and i1 < self.state["index"] + cInt):
n1 = nodes[i1]
i1+=1
if n1["fa2"]:
for i2 in range(len(nodes)):
if i2 < i1 and nodes[i2]["fa2"]:
Repulsion.apply_nn(n1, nodes[i2])
if (i1 == len(nodes)):
self.state["step"] = 2
self.state["index"] = 0
else:
self.state["index"] = i1
return True
elif case==2:
# Gravity
print "the case 2: Gravity"
Gravity=""
if self.p["strongGravityMode"]:
Gravity = ForceFactory.getStrongGravity(self.p["scalingRatio"])
else:
Gravity = ForceFactory.buildRepulsion(self.p["adjustSizes"],self.p["scalingRatio"])
gravity = self.p["gravity"]
scalingRatio = self.p["scalingRatio"]
i = self.state["index"]
while (i < len(nodes) and i < self.state["index"] + sInt):
n = nodes[i]
i+=1
if n["fa2"]:
Gravity.apply_g(n, gravity / scalingRatio)
if (i == len(nodes)):
self.state["step"] = 3
self.state["index"] = 0
else:
self.state["index"] = i
return True
elif case==3:
# Attraction
print "the case 3: Attraction"
field=""
if self.p["outboundAttractionDistribution"]:
field = self.p["outboundAttCompensation"]
else:
field = 1
Attraction = ForceFactory.buildAttraction(self.p["linLogMode"],self.p["outboundAttractionDistribution"],self.p["adjustSizes"],1*field)
i = self.state["index"]
if self.p["edgeWeightInfluence"] == 0:
while (i < len(edges) and i < self.state["index"] + cInt):
e = edges[i]
i+=1
s = nodes[self.nodesIndex[e["source"]]]
t = nodes[self.nodesIndex[e["target"]]]
Attraction.apply_nn(s, t, 1)
elif self.p["edgeWeightInfluence"] == 1:
while (i < len(edges) and i < self.state["index"] + cInt):
e = edges[i]
i+=1
s = nodes[self.nodesIndex[e["source"]]]
t = nodes[self.nodesIndex[e["target"]]]
Attraction.apply_nn(s, t, (e["weight"] or 1))
else:
while (i < len(edges) and i < self.state["index"] + cInt):
e = edges[i]
i+=1
t = nodes[self.nodesIndex[e["target"]]]
Attraction.apply_nn(t,(math.pow(e["weight"] or 1), self.p["edgeWeightInfluence"]))
if (i == len(edges)):
self.state["step"] = 4
self.state["index"] = 0
else:
self.state["index"] = i
return True
elif case==4:
# Auto adjust speed
print "the case 4: Auto-adjust speed"
totalSwinging=0# How much irregular movement
totalEffectiveTraction = 0 # Hom much useful movement
swingingSum=0
promdxdy=0
for i in range(len(nodes)):
n = nodes[i]
fixed = n["fixed"] or False
if not fixed and n["fa2"]:
swinging = math.sqrt(math.pow(n["fa2"]["old_dx"] - n["fa2"]["dx"], 2)+math.pow(n["fa2"]["old_dy"] - n["fa2"]["dy"], 2))
totalSwinging+=n["fa2"]["mass"]*swinging
totalEffectiveTraction +=n["fa2"]["mass"]*0.5*math.sqrt(math.pow(n["fa2"]["old_dx"] + n["fa2"]["dx"], 2)+math.pow(n["fa2"]["old_dy"] + n["fa2"]["dy"], 2))
self.p["totalSwinging"] = totalSwinging
self.p["totalEffectiveTraction"] = totalEffectiveTraction
#We want that swingingMovement < tolerance * convergenceMovement
targetSpeed = math.pow(self.p["jitterTolerance"], 2)*self.p["totalEffectiveTraction"]/self.p["totalSwinging"]
#But the speed shoudn't rise too much too quickly,
#since it would make the convergence drop dramatically.
maxRise = 0.5
self.p["speed"] = self.p["speed"]+min(targetSpeed-self.p["speed"],maxRise * self.p["speed"])
#Save old coordinates
for i in range(len(nodes)):
nodes[i]["old_x"] = +nodes[i]["x"]
nodes[i]["old_y"] = +nodes[i]["y"]
self.state["step"] = 5
return True
elif case==5:
# Apply forces
print "the case 5: Apply forces"
i = self.state["index"]
if self.p["adjustSizes"]:
speed = self.p["speed"]
while (i < len(nodes) and i < self.state["index"] + sInt):
n = nodes[i]
i+=1
fixed = n["fixed"] or False
if not fixed and n["fa2"]:
swinging = math.sqrt((n["fa2"]["old_dx"] - n["fa2"]["dx"])*(n["fa2"]["old_dx"] - n["fa2"]["dx"]) +(n["fa2"]["old_dy"] - n["fa2"]["dy"])*(n["fa2"]["old_dy"] - n["fa2"]["dy"]))
factor = 0.1 * speed / (1 + speed * math.sqrt(swinging))
df = math.sqrt(math.pow(n["fa2"]["dx"], 2)+math.pow(n["fa2"]["dy"], 2))
factor = min(factor * df, 10) / df
n["x"] += n["fa2"]["dx"] * factor
n["y"] += n["fa2"]["dy"] * factor
else:
speed = self.p["speed"]
while (i < len(nodes) and i < self.state["index"] + sInt):
n = nodes[i]
i+=1
fixed = n["fixed"] or False
if not fixed and n["fa2"]:
#Adaptive auto-speed: the speed of each node is lowered
#when the node swings.
swinging = math.sqrt((n["fa2"]["old_dx"] - n["fa2"]["dx"])*(n["fa2"]["old_dx"] - n["fa2"]["dx"]) +(n["fa2"]["old_dy"] - n["fa2"]["dy"])*(n["fa2"]["old_dy"] - n["fa2"]["dy"]))
factor = speed / (1 + speed * math.sqrt(swinging))
n["x"] += n["fa2"]["dx"] * factor
n["y"] += n["fa2"]["dy"] * factor
if (i == len(edges)):
self.state["step"] = 0
self.state["index"] = 0
return False
else:
self.state["index"] = i
return True
else:
# Do the default
print "Error"
return False
def getGraph(self):
nds = self.graph['nodes']
justNodes = []
for i in range(len(nds)):
n = {
"id":i,
"sID":nds[i]["id"],
"x":nds[i]["x"],
"y":nds[i]["y"],
"occ":nds[i]["degree"]
}
justNodes.append(n)
return justNodes
#! /usr/bin/python
import networkx as nx
import scipy as sp
import numpy as np
import random
import threading
import matplotlib.pyplot as plt
## Read a food web with > 100 nodes
'''
FW = nx.read_edgelist('web.edges', create_using= nx.DiGraph())
'''
## Plotting using the FR layout
#nx.draw_spring(FW,iterations=500)
#plt.show()
class FA2:
def eucl_dist(self,a,b):
"""
Euclidean distance
"""
Di = [(a[i]-b[i])**2 for i in xrange(len(a))]
return np.sqrt(np.sum(Di))
## Now the layout function
def forceatlas2_layout(self,G, iterations = 10, linlog = False, pos = None, nohubs = False, kr = 0.001, k = None, dim = 2):
"""
Options values are
g The graph to layout
iterations Number of iterations to do
linlog Whether to use linear or log repulsion
random_init Start with a random position
If false, start with FR
avoidoverlap Whether to avoid overlap of points
degreebased Degree based repulsion
"""
# We add attributes to store the current and previous convergence speed
for n in G:
G.node[n]['prevcs'] = 0
G.node[n]['currcs'] = 0
# To numpy matrix
# This comes from the spares FR layout in nx
A=nx.to_scipy_sparse_matrix(G,dtype='f')
nnodes,_=A.shape
from scipy.sparse import spdiags,coo_matrix
try:
A=A.tolil()
except:
A=(coo_matrix(A)).tolil()
if pos==None:
pos=np.asarray(np.random.random((nnodes,dim)),dtype=A.dtype)
else:
pos=pos.astype(A.dtype)
if k is None:
k=np.sqrt(1.0/nnodes)
# Iterations
# the initial "temperature" is about .1 of domain area (=1x1)
# this is the largest step allowed in the dynamics.
t=0.1
# simple cooling scheme.
# linearly step down by dt on each iteration so last iteration is size dt.
dt=t/float(iterations+1)
displacement=np.zeros((dim,nnodes))
for iteration in range(iterations):
displacement*=0
# loop over rows
for i in range(A.shape[0]):
# difference between this row's node position and all others
delta=(pos[i]-pos).T
# distance between points
distance=np.sqrt((delta**2).sum(axis=0))
# enforce minimum distance of 0.01
distance=np.where(distance<0.01,0.01,distance)
# the adjacency matrix row
Ai=np.asarray(A.getrowview(i).toarray())
# displacement "force"
Dist = k*k/distance**2
if nohubs:
Dist = Dist/float(Ai.sum(axis=1)+1)
if linlog:
Dist = np.log(Dist+1)
displacement[:,i]+=\
(delta*(Dist-Ai*distance/k)).sum(axis=1)
# update positions
length=np.sqrt((displacement**2).sum(axis=0))
length=np.where(length<0.01,0.1,length)
pos+=(displacement*t/length).T
# cool temperature
t-=dt
# Return the layout
return dict(zip(G,pos))
#nx.draw(G, forceatlas2_layout(G,linlog=False,nohubs=False,iterations=100))
#plt.show()
This diff is collapsed.
class RVUniformC:
def __init__(self,seed):
self.a=16807
self.b=0
self.m=2147483647
self.u=0
self.semilla=seed
self.x = self.semilla
def getRandom(self):
x = ((self.x*self.a)+self.b)%self.m
self.x = x
self.u = self.x/float(self.m)
return self.u
#instancia = RVUniformC(100000000)
#instancia.getUniform()
This diff is collapsed.
# -*- coding: utf-8 -*-
This diff is collapsed.
# -*- coding: utf-8 -*-
from FA2 import ForceAtlas2
from extractData import extract as SQLite
import sys
reload(sys)
sys.setdefaultencoding('utf-8')
from flask import Flask
from flask import request
import simplejson as json
app = Flask(__name__)
@app.route("/getJSON")
def main():
#query = request.args['query']
#{"categorya"%3A"Keywords"%2C"categoryb"%3A"Scholars"%2C"keywords"%3A[]%2C"countries"%3A["Chile"]%2C"laboratories"%3A[]%2C"coloredby"%3A[]%2C"tags"%3A[]%2C"organizations"%3A[]}
# i=int(sys.argv[2])
# unique_id = sys.argv[1]
# db=SQLite(unique_id)
# db.extract()
# < Data Extraction > #
i = int(request.args['it'])
if request.args.has_key("query"):
db=SQLite("")
print request.args['query']
print i
db.extract2(request.args['query'])
else:
unique_id = request.args['unique_id']
db=SQLite(unique_id)
db.extract()
# < / Data Extraction > #
tempGraph = db.buildSimpleJSONFinal(db.Graph)
spatialized = ForceAtlas2(tempGraph)
spatialized.init()
spatialized.getGraph()
# for i in range(0,i):
# spatialized.atomicGo()
graphArray = db.buildJSON_sansfa2(db.Graph,spatialized.getGraph())
return json.dumps(graphArray)
if __name__ == "__main__":
# main()
app.run(port=8080)
This diff is collapsed.
# -*- coding: utf-8 -*-
from extractData import extract as SQLite
import time
import sys
reload(sys)
sys.setdefaultencoding('utf-8')
def main():
db=SQLite("")
print "Start"
start = time.time()
db.extract2('SELECT * FROM scholars where country = "'+sys.argv[1]+'"')
end = time.time()
seconds1=end-start
print "End"
print "\ttotal: "+str(seconds1)+"[s]"
#return queryFromFilter#json.dumps(graphArray)
if __name__ == "__main__":
main()
#app.run(port=8080)
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment