<?xml version="1.0" encoding="UTF-8"?>
<rss version="2.0">
	<channel>
		<title>12월 사수자리</title>
		<link>http://sunhwan.tistory.com/</link>
		<description>Kansas 통신</description>
		<language>ko</language>
		<pubDate>Tue, 16 Aug 2011 16:06:33 -0500</pubDate>
		<generator>Tistory 1.1 (http://www.tistory.com/)</generator>
		<item>
			<title>시력보호 USB??</title>
			<link>http://sunhwan.tistory.com/entry/%EC%8B%9C%EB%A0%A5%EB%B3%B4%ED%98%B8-USB</link>
			<description>http://link.allblog.net/23630506/http://loved.pe.kr/entry/T-POWER-U-01&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
에 남긴 코멘트 내용..&lt;br /&gt;
&lt;br /&gt;
&lt;blockquote&gt;저도 스칼라에너지에 대해선 처음 듣는것이라 생소해서 찾아봤습니다.&lt;br /&gt;
&lt;br /&gt;

http://en.wikipedia.org/wiki/Scalar_field_theory_(pseudoscience)&lt;br /&gt;
&lt;br /&gt;몇가지 배운것은, scalar field 는 두개의 서로 상반된 phase 의 전자기장이 서로를 상쇄하면서 생기는 scalar bubble 때문에 시공간을 자유로이 통과할 수 있고, 3차원상의 에너지 보존 원리 (science) 를 우회함으로써 다른 차원에서 에너지를 끌어올 수 있다 (에너지 보존을 4차원의 시공간상에서 만족합니다. 이는 pseudoscience - 입증되지 않았음) 는 것이네요..

&lt;br /&gt;
&lt;br /&gt;일단 해당 이론이 현재 까지는 받아들여지고 있지 않은게 맞구요. 전자기학에서는 서로 상쇄하는 전자기장을 내놓는다면 scalar bubble 이 생기는게 아니고, 그냥 서로 상쇄되고 만다.. 에너지 낭비일 뿐이다, 이렇게 설명을 하니까요.. 4차원에서의 에너지 보존도 받아들여지지 않은 내용입니다.&lt;br /&gt;
&lt;br /&gt;해당 이론에 대해서 뭐라고 하기 보다도, 제품 자체에 관해 잘 이해가 안 되는게..&lt;br /&gt;
&lt;br /&gt;1. 비디오를 보면 모니터를 통해서 스케일러 에너지가 전달이 된다고 나오는데요.. 위에 쓰신대로라면 usb 장치로 인식을 하지 않습니다. 즉, 드라이버가 컴퓨터에 없다는 것이지요. 이는 해당 장치가 컴퓨터와 커뮤니케이션 할 수 있는 방법이 없다는 것입니다. 어떻게 디스플레이의 신호를 바꿔서 스케일러 에너지가 나오게 될까요??&lt;br /&gt;
&lt;br /&gt;2. 컴퓨터에서 발생하는 전자파를 차단하고자 한다면, 컴퓨터에서 발생하는 전자파와 정확하게 파형이 반대로 되는 전자파를 발생해서 서로 상쇄해야할 텐데요, 그걸 모니터링해서 상쇄되는 파장을 발생하는 것은 불가능할 것 같네요. 아무래도 기기 자체에서 두개의 자장을 발생하는 장치가 들어 있을 것 같습니다. 그렇다면 전자파 차단 효과는 없다는....
&lt;br /&gt;
&lt;br /&gt;
본체 뒤에 꼽아야하는것은 안정적인 전원공급이 필요하기 때문인것 같습니다. 전자파 자체는 요즘은 다 lcd 를 사용하기 때문에 크게 문제가 되지는 않는다고 생각합니다. 다만 장시간 화면을 바라봄으로써 안구 건조증이나 시력감퇴가 더 큰 문제가 되겠지요. 이것또한 scalar energy 가 말하는 &#039;힐링&#039; 수준에서 치료될 수 있는게 아니라고 생각합니다.&lt;br /&gt;
&lt;br /&gt;오히려 eye strain 을 줄여주는 여러 안경류의 제품이 있으니 참고해시길 바랍니다..&lt;br /&gt;
http://gizmodo.com/5046530/lightning-review-gunnar-optiks-eye-strain+reducing-computer-glasses&lt;br /&gt;
http://gizmodo.com/5326261/wink-glasses-will-make-you-blink&lt;br /&gt;
&lt;/blockquote&gt;</description>
			<category>pseudoscience</category>
			<author>12월 사수자리</author>
			<guid>http://sunhwan.tistory.com/74</guid>
			<comments>http://sunhwan.tistory.com/entry/%EC%8B%9C%EB%A0%A5%EB%B3%B4%ED%98%B8-USB#entry74comment</comments>
			<pubDate>Sat, 14 Nov 2009 10:12:17 -0600</pubDate>
		</item>
		<item>
			<title>DC 관광</title>
			<link>http://sunhwan.tistory.com/entry/DC-%EA%B4%80%EA%B4%91</link>
			<description>&lt;div class=&quot;imageblock center&quot; style=&quot;text-align: center; clear: both;&quot;&gt;&lt;a href=&quot;http://cfs13.tistory.com/original/11/tistory/2009/07/23/01/36/4a67400f0858f&quot; rel=&quot;lightbox&quot; target=&quot;_blank&quot;&gt;&lt;img src=&quot;http://cfs13.tistory.com/image/11/tistory/2009/07/23/01/36/4a67400f0858f&quot; alt=&quot;사용자 삽입 이미지&quot; height=&quot;614&quot; width=&quot;460&quot;/&gt;&lt;/a&gt;&lt;/div&gt;&lt;br /&gt;
&lt;br /&gt;
Lincoln Memorial 에서 바라본 Washington Monument&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;

&lt;div class=&quot;imageblock center&quot; style=&quot;text-align: center; clear: both;&quot;&gt;&lt;a href=&quot;http://cfs13.tistory.com/original/25/tistory/2009/07/23/01/36/4a6740158a0ba&quot; rel=&quot;lightbox&quot; target=&quot;_blank&quot;&gt;&lt;img src=&quot;http://cfs13.tistory.com/image/25/tistory/2009/07/23/01/36/4a6740158a0ba&quot; alt=&quot;사용자 삽입 이미지&quot; height=&quot;460&quot; width=&quot;614&quot;/&gt;&lt;/a&gt;&lt;/div&gt;&lt;br /&gt;
&lt;br /&gt;
White house&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
제일 인상깊었던것은 Lincoln Memorial. 신전형태로 되어 있는것에 한번 놀라고, 안에는 오직 거대한 링컨이 모셔져 있다는 점에서 또 한번 놀랬음.</description>
			<author>12월 사수자리</author>
			<guid>http://sunhwan.tistory.com/73</guid>
			<comments>http://sunhwan.tistory.com/entry/DC-%EA%B4%80%EA%B4%91#entry73comment</comments>
			<pubDate>Wed, 22 Jul 2009 11:38:47 -0500</pubDate>
		</item>
		<item>
			<title>xkcd: estimation</title>
			<link>http://sunhwan.tistory.com/entry/xkcd-estimation</link>
			<description>&lt;div class=&quot;imageblock center&quot; style=&quot;text-align: center; clear: both;&quot;&gt;&lt;a href=&quot;http://cfs10.tistory.com/original/9/tistory/2009/07/20/13/38/4a63f4b79f355&quot; rel=&quot;lightbox&quot; target=&quot;_blank&quot;&gt;&lt;img src=&quot;http://cfs10.tistory.com/image/9/tistory/2009/07/20/13/38/4a63f4b79f355&quot; alt=&quot;사용자 삽입 이미지&quot; height=&quot;335&quot; width=&quot;297&quot;/&gt;&lt;/a&gt;&lt;/div&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;a href=&quot;http://xkcd.com/612/&quot;&gt;estimation&lt;/a&gt;&lt;br /&gt;
&lt;br /&gt;
Too bad I almost forgot about this file copying estimation thing after switch to apple.</description>
			<category>random</category>
			<author>12월 사수자리</author>
			<guid>http://sunhwan.tistory.com/72</guid>
			<comments>http://sunhwan.tistory.com/entry/xkcd-estimation#entry72comment</comments>
			<pubDate>Sun, 19 Jul 2009 23:40:14 -0500</pubDate>
		</item>
		<item>
			<title>dropbox saved my life</title>
			<link>http://sunhwan.tistory.com/entry/dropbox-saved-my-life</link>
			<description>I used to be a big fan of &amp;lt;a href=&quot;http://www.getdropbox.com&quot;&amp;gt;dropbox&amp;lt;/a&amp;gt;. And now I become much more than just a big fan; it just saved my life.&lt;br /&gt;&lt;br /&gt;Basically I have a couple of computers here and there that I use everyday. I have one iMac in my computational lab, and one another iMac in my other lab office. I have a laptop that I carry everyday, and I have an iMac at home. You can easily imagine how much effort do I need to keep my files neat and accessible. I was using an rsync to do so. I had a script to do primitive syncing and duplication checking. But sometimes I just make mistake that I switched source and destination, and I had some newer files overwritten by older files, which practically drives me nuts. &lt;br /&gt;&lt;br /&gt;And I&#039;ve came across with dropbox. It is basically a web storage, however, it comes with a desktop client that monitors your filesystem and automatically sync files over the net whenever modifications are found in your file. What makes it even nicer is, it pushes the notification to all the computers that have dropbox desktop client and syncs the files. So, as soon as I change one file in my laptop, the file is get synced to all of my three iMacs plus to the web storage. It is pretty smooth.&lt;br /&gt;&lt;br /&gt;Today, I made a mistake (yes, again); I&#039;ve opened a file, which is important (yes, somehow, important files are frequently involved in mistakes), and started making changes. Over the course of editing, I realized I&#039;ve deleted too many things. What can I do? If I had a time machine set up, I could go back to the older version pretty easily, but I didn&#039;t have my time machine set up in that computer. What can I do?&lt;br /&gt;&lt;br /&gt;Like I told earlier, dropbox saved my life. It even keeps revisions!!&lt;br /&gt;&lt;br /&gt;&lt;div class=&quot;imageblock center&quot; style=&quot;text-align: center; clear: both;&quot;&gt;&lt;a href=&quot;http://cfs12.tistory.com/original/36/tistory/2009/07/08/14/02/4a54285f5887e&quot; rel=&quot;lightbox&quot; target=&quot;_blank&quot;&gt;&lt;img src=&quot;http://cfs12.tistory.com/image/36/tistory/2009/07/08/14/02/4a54285f5887e&quot; alt=&quot;사용자 삽입 이미지&quot; height=&quot;194&quot; width=&quot;640&quot;/&gt;&lt;/a&gt;&lt;/div&gt;&lt;br /&gt;Dropbox is a web storage + version control. I can&#039;t imagine my life without dropbox anymore.&lt;br /&gt;</description>
			<category>지쟈스</category>
			<author>12월 사수자리</author>
			<guid>http://sunhwan.tistory.com/71</guid>
			<comments>http://sunhwan.tistory.com/entry/dropbox-saved-my-life#entry71comment</comments>
			<pubDate>Wed, 08 Jul 2009 00:04:24 -0500</pubDate>
		</item>
		<item>
			<title>google app engine 체험기..</title>
			<link>http://sunhwan.tistory.com/entry/google-app-engine-%EC%B2%B4%ED%97%98%EA%B8%B0</link>
			<description>&lt;div class=&quot;imageblock center&quot; style=&quot;text-align: center; clear: both;&quot;&gt;&lt;a href=&quot;http://cfs14.tistory.com/original/15/tistory/2009/07/02/14/27/4a4c454084fb0&quot; rel=&quot;lightbox&quot; target=&quot;_blank&quot;&gt;&lt;img src=&quot;http://cfs14.tistory.com/image/15/tistory/2009/07/02/14/27/4a4c454084fb0&quot; alt=&quot;사용자 삽입 이미지&quot; height=&quot;407&quot; width=&quot;640&quot;/&gt;&lt;/a&gt;&lt;/div&gt;
&lt;br /&gt;
현업에 종사하고 있지 않다 보니, 이런저런 아이디어들은 있는데, 쉽게 적용해 볼 수 있는 기회가 적다. 몇달이 넘도록 그냥 &#039;해보고 싶은것&#039; 목록에 남아 있는 한가지가 Google App Engine 사용해 보기 였다. 마침, 학과에서 자체 심포지움을 하는데, 나보고 발표자료의 초록 (abstract) 을 모아보도록 하였고, 이 기회에 초록 데이터베이스를, Google App Engine 을 이용해보면 좋겠다는 생각이 들었다. &lt;br /&gt;
&lt;br /&gt;
Google App Engine 이 매력적인 이유는,&lt;br /&gt;
1. 초기 호스팅 비용이 들지 않는다. 어느정도 quota 안에서는 무료&lt;br /&gt;
2. appspot.com 무료 2차 도메인&lt;br /&gt;
3. 내가 좋아하는 Python 으로 웹프로그래밍을 할 수 있음&lt;br /&gt;
4. Python 웹 프레임웍인 django 와 호환이 됨&lt;br /&gt;&lt;br /&gt;
&lt;br /&gt;
&lt;div class=&quot;imageblock center&quot; style=&quot;text-align: center; clear: both;&quot;&gt;&lt;a href=&quot;http://cfs12.tistory.com/original/25/tistory/2009/07/02/14/37/4a4c479cc38f2&quot; rel=&quot;lightbox&quot; target=&quot;_blank&quot;&gt;&lt;img src=&quot;http://cfs12.tistory.com/image/25/tistory/2009/07/02/14/37/4a4c479cc38f2&quot; alt=&quot;사용자 삽입 이미지&quot; height=&quot;405&quot; width=&quot;566&quot;/&gt;&lt;/a&gt;&lt;/div&gt;
&lt;br /&gt;
Google App Engine Launcher 라는 프로그램을 통해 기본 파일 구조를 생성하여, 로컬에서 구축/테스트 한 후, 서버로 업로드 하는 방식으로 개발이 진행된다. 기본적으로는 Google 자체 프레임웍을 사용하며, 원할 경우 수동으로 django 프레임웍을 사용할 수도 있다.&lt;br /&gt;
&lt;br /&gt;
간단한 app 을 만들고 deploy 해 본 후 느낀점은,&lt;br /&gt;
1. 로컬 테스트 / 서버 deploy 하는 프로세스가 맘에 듦.&lt;br /&gt;
2. App Engine Launcher 의 데이터 베이스 도우미 및 deploy 도우미가 잘 작동함&lt;br /&gt;
3. 프레임웍은 아직 좀 원시적인듯&lt;br /&gt;
4. django 템플릿 엔진을 거의 그대로 사용하는듯&lt;br /&gt;
&lt;br /&gt;
이상. 혹시 소스가 필요하신 분은 &lt;a href=&quot;http://github.com/sunhwan/abstractsub/tree/master&quot;&gt;Github&lt;/a&gt;로..&lt;br /&gt;
</description>
			<category>google app engine</category>
			<category>Python</category>
			<author>12월 사수자리</author>
			<guid>http://sunhwan.tistory.com/70</guid>
			<comments>http://sunhwan.tistory.com/entry/google-app-engine-%EC%B2%B4%ED%97%98%EA%B8%B0#entry70comment</comments>
			<pubDate>Thu, 02 Jul 2009 00:46:36 -0500</pubDate>
		</item>
		<item>
			<title>good symfony slides</title>
			<link>http://sunhwan.tistory.com/entry/good-symfony-slides</link>
			<description>http://www.symfonylab.com/symfony-conference-most-interesting-slides-ideas/&lt;br /&gt;
&lt;br /&gt;
1. Symfony 2 by Fabien Potencier&lt;br /&gt;
2. Sympal – The flexible Symfony CMS by Jonathan H. Wage&lt;br /&gt;
3. What’s New In Doctrine by Jonathan H. Wage&lt;br /&gt;
</description>
			<category>Symfony</category>
			<author>12월 사수자리</author>
			<guid>http://sunhwan.tistory.com/69</guid>
			<comments>http://sunhwan.tistory.com/entry/good-symfony-slides#entry69comment</comments>
			<pubDate>Mon, 22 Jun 2009 01:15:56 -0500</pubDate>
		</item>
		<item>
			<title>sproutcore, first excercise</title>
			<link>http://sunhwan.tistory.com/entry/sproutcore-first-excercise</link>
			<description>E&lt;div class=&quot;imageblock center&quot; style=&quot;text-align: center; clear: both;&quot;&gt;&lt;a href=&quot;http://cfs11.tistory.com/original/27/tistory/2009/06/17/13/12/4a386d46458c3&quot; rel=&quot;lightbox&quot; target=&quot;_blank&quot;&gt;&lt;img src=&quot;http://cfs11.tistory.com/image/27/tistory/2009/06/17/13/12/4a386d46458c3&quot; alt=&quot;사용자 삽입 이미지&quot; height=&quot;293&quot; width=&quot;500&quot;/&gt;&lt;/a&gt;&lt;/div&gt;
&lt;br /&gt;
&lt;br /&gt;
Sproutcore is one of javascript MVC framework that takes care of client side UI like full-blown desktop application. So far, Sproutcore is used in Apple&#039;s &lt;a href=&quot;http://me.com&gt;MobleMe&lt;/a&gt; and &lt;a href=&quot;http://otherinbox.com&quot;&gt;otherinbox&lt;/a&gt;. &lt;br /&gt;
&lt;br /&gt;
Ever since the library is open to public, I wanted to have an hands-on experience. And this post is about it. &lt;br /&gt;
&lt;br /&gt;
I wanted to make a web-based queue checking page that takes my keyword and list all the jobs in the queue contains such keyword. Server-end is quite simple: grab output from system call &quot;ssh server | grep keyword&quot;. However, build a front-end UI using sproutcore was little tricky. I wasn&#039;t even ambitious to make the UI fancier, but I ended up spending more than 6 hours, I guess. &lt;br /&gt;
&lt;br /&gt;
One of the big drawback was lack of documentation. There are few examples available in their website, but they are just too simple, and API reference only have some obvious explanation. Sproutcore is a framework, so it works like a black box. In that sense, I think the main developer should provide comprehensive examples that shows various usage of the framework and utilities. They could also provide general overview on how things are intertwined so that a developers who use the framework can attain better insight on how to add functionality. &lt;a href=&quot;http://symfony-project.com&gt;Symfony&lt;/a&gt;, a PHP MVC framwork, have done these kinds of documentation very well, I think. However, Sproutcore seems, at least in current stage, clearly not able to provide enough documents for new-comers.&lt;br /&gt;
&lt;br /&gt;
Although it wasn&#039;t easy to have a quick idea on how things are put together, once I figure out how I can manipulate components and observe user-inputs, I was able to move forward. One of the great advantage of javascript framework these days is the great javascript support from the modern browsers like Safari and firefox. Using a default javascript debugger, one can nail it down to the exact location to the error, or examine properties of object easily using javascript shell.&lt;br /&gt;
&lt;br /&gt;
&lt;div class=&quot;imageblock center&quot; style=&quot;text-align: center; clear: both;&quot;&gt;&lt;a href=&quot;http://cfs13.tistory.com/original/24/tistory/2009/06/17/13/50/4a387602ca451&quot; rel=&quot;lightbox&quot; target=&quot;_blank&quot;&gt;&lt;img src=&quot;http://cfs13.tistory.com/image/24/tistory/2009/06/17/13/50/4a387602ca451&quot; alt=&quot;사용자 삽입 이미지&quot; height=&quot;551&quot; width=&quot;640&quot;/&gt;&lt;/a&gt;&lt;/div&gt;
&lt;br /&gt;
&lt;br /&gt;Javascript frameworks like Sproutcore and Cappuccino clearly draw lines between server-side backend and client-side frontend. No more template and other types of nasty distinction between view and model-controller layer in server-side language is needed once this takes off, which is a still big issue between web developers. To go there, I think, one thing is missing; visual layout editor. And people in 280north are working very hard to bring Atlas, a javascript visual layout editor for Cappuccino, public, so let&#039;s keep my hope on.&lt;br /&gt;
&lt;br /&gt;
My source codes are uploaded to &lt;a href=&quot;http://github.com/sunhwan/queue/&quot;&gt;GitHub&lt;/a&gt;.</description>
			<category>SproutCore</category>
			<author>12월 사수자리</author>
			<guid>http://sunhwan.tistory.com/68</guid>
			<comments>http://sunhwan.tistory.com/entry/sproutcore-first-excercise#entry68comment</comments>
			<pubDate>Wed, 17 Jun 2009 00:06:53 -0500</pubDate>
		</item>
		<item>
			<title>finding symmetric cycles in a graph</title>
			<link>http://sunhwan.tistory.com/entry/finding-symmetric-cycles-in-a-graph</link>
			<description>&lt;div class=&quot;imageblock center&quot; style=&quot;text-align: center; clear: both;&quot;&gt;&lt;a href=&quot;http://cfs10.tistory.com/original/14/tistory/2009/06/16/14/12/4a3729da97828&quot; rel=&quot;lightbox&quot; target=&quot;_blank&quot;&gt;&lt;img src=&quot;http://cfs10.tistory.com/image/14/tistory/2009/06/16/14/12/4a3729da97828&quot; alt=&quot;사용자 삽입 이미지&quot; height=&quot;480&quot; width=&quot;640&quot;/&gt;&lt;/a&gt;&lt;/div&gt;
&lt;br /&gt;
So, here is a ligand for FKBP named, 1,3-DIPHENYL-1-PROPYL-1-(3,3-DIMETHYL-1,2- DIOXYPENTYL)-2-PIPERIDINE CARBOXYLATE. The thing I wanted to do was to find all symmetric cycles, so that I can restrict the rotation during my calculation. In this example, I&#039;d like to find out two phenyl rings that have C22 and C16. The ring system that have N in it is not symmetrical, so my program should be able to discriminate this.&lt;br /&gt;
&lt;br /&gt;
At first, I thought it could be done easily if I use some sort of graph library. After a quick research, I decided to try out &lt;a href=&quot;http://networkx.lanl.gov/&quot;&gt;networkx&lt;/a&gt; and &lt;a href=&quot;http://code.google.com/p/python-graph/&quot;&gt;python-graph&lt;/a&gt;, and finally decided to stick with &lt;a href=&quot;http://networkx.lanl.gov/&quot;&gt;networkx&lt;/a&gt; because it depends less amount of other library and seems more mature than &lt;a href=&quot;http://code.google.com/p/python-graph/&quot;&gt;; however &lt;a href=&quot;http://code.google.com/p/python-graph/&quot;&gt;python-graph&lt;/a&gt; also looks decent and it&#039;s source code actually helped me later to figure out finding cycles in my graph.&lt;br /&gt;
&lt;br /&gt;
I started read tutorial and making some testcases, and, then, realized it does not have a nice method to detecting cycles in a graph. The same was true for determining whether the cycle is symmetric or not. So, I have to come up with my own, although I&#039;ve helped out by numerous discussions on the web. &lt;br /&gt;
&lt;br /&gt;
Here&#039;s my version.&lt;br /&gt;
&lt;br /&gt;
&lt;blockquote&gt;&lt;pre&gt;#!/usr/bin/env python
 
import networkx as nx
import time
import re
 
def ligand_topology(filename=&#039;testcases/sb3/sb3/sb3.rtf&#039;):
    G = nx.LabeledGraph()
    f = open(filename, &#039;r&#039;)
    atm = {}
    for line in f.readlines():
        if line.startswith(&quot;ATOM&quot;):
            entry = re.split(&#039;\s+&#039;, line)
            atm[entry[1]] = {&#039;type&#039;: entry[2], &#039;charge&#039;: entry[3]}
        if line.startswith(&#039;BOND&#039;):
            entry = re.split(&#039;\s+&#039;, line)
            G.add_node(entry[1], atm[entry[1]])
            G.add_node(entry[2], atm[entry[2]])
            G.add_edge(entry[1], entry[2])
    return G
    
def is_cycle(graph, source):
    def dfs(node):
        visited.append(node)
        for each in graph[node]:
            if (cycle):
                return 
            if graph.degree(each) &lt; 2:
                continue
            if each not in visited:
                spanning_tree[node] = each
                dfs(each)
                nodes.append(each)
                if each != spanning_tree[source] and source in graph[each]:
                    cycle.append(each)
            if not cycle and node == source:
                while nodes: nodes.pop()
                pass
                #while cycle: cycle.pop()
                #while visited: visited.pop()
    
    visited = []
    cycle = []
    nodes = []
    spanning_tree = {}
    dfs(source)
    return nodes
 
def is_symmetric(graph, subgraph, nbunch):
    # this is not true, but i&#039;ll just skip when a ring has more than one entry point
    count = 0
    entry = None
    for n in subgraph:
        if graph.degree(n) is not subgraph.degree(n):
            count +=1
            entry = n
    if count &gt; 1: return False
    
    # build distance list from the root element
    # TODO: currently, it only compares the atom types to determine whether it is symmetric. 
    # this is potential pot hole because if some kind of isomers are there, it will not able
    # to detect it.
    root = subgraph[entry].keys()[0]
    dist = {}
    for n in nbunch:
        if n == root: continue
        distance = nx.shortest_path_length(subgraph,root, n)
        if dist.has_key(distance): dist[distance].append(n)
        else: dist[distance] = [n]
    
    for d,nodes in dist.items():
        sub = None
        if len(nodes) &lt; 2: continue
        for n in nodes:
            if sub == None: sub = set([x[0] for x in subgraph.neighbors(n)])
            else: 
                if sub != set([x[0] for x in subgraph.neighbors(n)]): return False
    
    return True
  
def find_all_cycles(graph, build=False):
    # remove all nodes that have only one connection
    degrees = {}
    for node in graph.nodes():
        degree = graph.degree(node)
        if degrees.has_key(degree): degrees[degree].append(node)
        else: degrees[degree] = [node]
    
    # find all cycles
    max_degree = max(degrees.keys())
    cycles = []
    for i in range(max_degree, 2, -1):
        for node in degrees[i]:
            cycle = set(is_cycle(graph, node))
            
            # uniqify cycles
            if cycle:
                uc = [node]
                for c in cycle:
                    u = set(is_cycle(graph, c))
                    if node not in u: continue
                    else: uc.append(c)
                h = G.subgraph(uc)
                s = set(nx.node_connected_component(h, node))
                if s not in cycles:
                    cycles.append(s)
    
    if build:
        tmp_cycles = []
        for cycle in cycles:
            h = nx.Graph()
            h.add_edges_from(graph.edges(cycle))
            tmp_cycles.append(h)
        cycles = tmp_cycles
                    
    return cycles
 
def find_all_sym_cycles(graph):
    cycles = find_all_cycles(graph)
    sym_cycles = []
    
    for cycle in cycles:
        h = nx.Graph()
        h.add_edges_from(graph.edges(cycle))
        is_sym = is_symmetric(graph, h, cycle)
        if is_sym:
            sym_cycles.append(h)
    
    return sym_cycles

 
if __name__ == &#039;__main__&#039;:
    G = ligand_topology()
    # ubigraph server should already be running
    #G = nx.UbiGraph()
    
    cycles = find_all_sym_cycles(G)
    for cycle in cycles:
        print cycle.nodes()
        #[&#039;C22&#039;, &#039;C23&#039;, &#039;C26&#039;, &#039;C27&#039;, &#039;C24&#039;, &#039;C25&#039;, &#039;H32&#039;, &#039;H33&#039;, &#039;H30&#039;, &#039;H31&#039;, &#039;H34&#039;, &#039;C13&#039;]
        #[&#039;C20&#039;, &#039;C21&#039;, &#039;H29&#039;, &#039;H28&#039;, &#039;H25&#039;, &#039;H27&#039;, &#039;H26&#039;, &#039;C19&#039;, &#039;C18&#039;, &#039;C17&#039;, &#039;C16&#039;, &#039;C15&#039;]

&lt;/pre&gt;&lt;/blockquote&gt;&lt;br /&gt;
&lt;br /&gt;
So, basically two things:&lt;br /&gt;
1. find all cycles&lt;br /&gt;
2. determine whether the cycle is symmetric&lt;br /&gt;
&lt;br /&gt;
The first one can be done by building depth-first-search (dfs) tree. If the dfs tree ended up having the root node that the tree is started from then the root node is one of element of the cycle. In my case, I&#039;ve exhaustively tested each node whether the node is a component of a cycle. And I tried reduce cycles by finding intersecting nodes only. This was necessary because, for some nodes, dfs tree expanded to have non-cycle component nodes as well.&lt;br /&gt;
&lt;br /&gt;
After every possible &quot;unique&quot; cycles are found, I needed to determine whether the cycle is symmetric. Uh, symmetric with respect to what? Right, now I need to know which edge can be used as a rotation axis. Thanks to the graph library, it has a subgraph method which returns a &quot;connected&quot; subgraph of given nodes. By just plugging in my cycle nodes, I got back a connected graph that have all the cyclic components plus one extra node that is not part of cycle; in fact this node is the node that connects the cycle and the rest of the graph. So the degree of the node in our overall graph and subgraph must be different, and the edge between the node and the root node can be used as a rotational axis. &lt;br /&gt;
&lt;br /&gt;
Now, actual symmetry detection. I could have used a built-in method, which compares whether two graphs are isomorphic after defining graph on the left and graph on the right of the root. However, the problem is, my actual use-case is about atom, which makes two nodes identical if they are in same type (e.g. H11 node and H12 nodes are identical in that sense). So, I ended up just comparing atom types only after building a distance map starting from the root node.&lt;br /&gt;
&lt;br /&gt;
Please bear with me that this is very rough work and I didn&#039;t know nothing about graph theory before. Any comments to improve this are welcome.</description>
			<category>Graph</category>
			<category>Python</category>
			<author>12월 사수자리</author>
			<guid>http://sunhwan.tistory.com/67</guid>
			<comments>http://sunhwan.tistory.com/entry/finding-symmetric-cycles-in-a-graph#entry67comment</comments>
			<pubDate>Tue, 16 Jun 2009 00:57:21 -0500</pubDate>
		</item>
		<item>
			<title>우리아이와 함께 만든 두번째 스크래치</title>
			<link>http://sunhwan.tistory.com/entry/%EC%9A%B0%EB%A6%AC%EC%95%84%EC%9D%B4%EC%99%80-%ED%95%A8%EA%BB%98-%EB%A7%8C%EB%93%A0-%EB%91%90%EB%B2%88%EC%A7%B8-%EC%8A%A4%ED%81%AC%EB%9E%98%EC%B9%98</link>
			<description>&lt;applet id=&#039;ProjectApplet&#039; style=&#039;display:block&#039; code=&#039;ScratchApplet&#039; codebase=&#039;http://scratch.mit.edu/static/misc&#039; archive=&#039;ScratchApplet.jar&#039; height=&#039;387&#039; width=&#039;482&#039;&gt;&lt;param name=&#039;project&#039; value=&#039;../../static/projects/sunhwan/549932.sb&#039;&gt;&lt;/applet&gt; &lt;a href=&#039;http://scratch.mit.edu/projects/sunhwan/549932&#039;&gt;Learn more about this project&lt;/a&gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
두번째 스크래치 프로젝트!&lt;br /&gt;
화면을 클릭하면 보트가 움직입니다. ^^;&lt;br /&gt;
&lt;br /&gt;
p.s. 자바 애플릿이 가능한 브라우저가 필요합니다.</description>
			<category>scratch</category>
			<author>12월 사수자리</author>
			<guid>http://sunhwan.tistory.com/66</guid>
			<comments>http://sunhwan.tistory.com/entry/%EC%9A%B0%EB%A6%AC%EC%95%84%EC%9D%B4%EC%99%80-%ED%95%A8%EA%BB%98-%EB%A7%8C%EB%93%A0-%EB%91%90%EB%B2%88%EC%A7%B8-%EC%8A%A4%ED%81%AC%EB%9E%98%EC%B9%98#entry66comment</comments>
			<pubDate>Sat, 30 May 2009 21:23:11 -0500</pubDate>
		</item>
		<item>
			<title>이미지가 Internet Explorer 에서만 안 보이는 경우..</title>
			<link>http://sunhwan.tistory.com/entry/%EC%9D%B4%EB%AF%B8%EC%A7%80%EA%B0%80-Internet-Explorer-%EC%97%90%EC%84%9C%EB%A7%8C-%EC%95%88-%EB%B3%B4%EC%9D%B4%EB%8A%94-%EA%B2%BD%EC%9A%B0</link>
			<description>&lt;div class=&quot;imageblock center&quot; style=&quot;text-align: center; clear: both;&quot;&gt;&lt;a href=&quot;http://cfs14.tistory.com/original/17/tistory/2009/05/31/06/19/4a21a2ebc1e2c&quot; rel=&quot;lightbox&quot; target=&quot;_blank&quot;&gt;&lt;img src=&quot;http://cfs14.tistory.com/image/17/tistory/2009/05/31/06/19/4a21a2ebc1e2c&quot; alt=&quot;사용자 삽입 이미지&quot; height=&quot;791&quot; width=&quot;400&quot;/&gt;&lt;/a&gt;&lt;/div&gt;
&lt;br /&gt;
&lt;br /&gt;
Internet Explorer 를 사용하십니까? 그렇담 위에 이미지가 보이십니까?&lt;br /&gt;
안보이신다구요? 그럼 firefox 로도 이 페이지를 열어보시죠.. 이미지가 보일 겁니다.&lt;br /&gt;
&lt;br /&gt;
이 문제로 고민하기를 이틀..&lt;br /&gt;
결국 문제는 IE 의 경우 CMYK 모드로 저장된 이미지 파일을 표시하지 못 한다는 결론에 도달했습니다.&lt;br /&gt;
웹에 올리는 이미지는 RGB 모드로 저장합시다 (For dumbest IE...).&lt;br /&gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
p.s. 혹시 크루즈 여행에 관심있으신 분은 &lt;a href=&quot;http://www.ilovecruise.co.kr&quot;&gt;여기로~&lt;/a&gt;</description>
			<category>Jackass</category>
			<author>12월 사수자리</author>
			<guid>http://sunhwan.tistory.com/65</guid>
			<comments>http://sunhwan.tistory.com/entry/%EC%9D%B4%EB%AF%B8%EC%A7%80%EA%B0%80-Internet-Explorer-%EC%97%90%EC%84%9C%EB%A7%8C-%EC%95%88-%EB%B3%B4%EC%9D%B4%EB%8A%94-%EA%B2%BD%EC%9A%B0#entry65comment</comments>
			<pubDate>Sat, 30 May 2009 16:22:10 -0500</pubDate>
		</item>
	</channel>
</rss>

