Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Master #1

Open
wants to merge 6 commits into
base: dev
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion .gitignore
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
.idea/
.vscode/
.vscode/
51 changes: 37 additions & 14 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -3,37 +3,34 @@ project(datastruct-exp)

set(CMAKE_CXX_STANDARD 14)

add_compile_options(-mwindows)


set(PROJECT_INC_DIR ${PROJECT_SOURCE_DIR}/include)
set(LIBRARY_OUTPUT_PATH ${PROJECT_SOURCE_DIR}/lib)
set(CMAKE_LIBRARY_OUTPUT_DIRECTORY ${PROJECT_SOURCE_DIR}/lib)
set(CMAKE_ARCHIVE_OUTPUT_DIRECTORY ${PROJECT_SOURCE_DIR}/lib)
set(EXECUTABLE_OUTPUT_PATH ${PROJECT_SOURCE_DIR}/bin)

#set(CMAKE_BUILD_WITH_INSTALL_RPATH TRUE)
#set(CMAKE_INSTALL_RPATH_USE_LINK_PATH TRUE)
#set(CMAKE_INSTALL_RPATH ./lib)
set(CMAKE_RUNTIME_OUTPUT_DIRECTORY ${PROJECT_SOURCE_DIR}/bin)
set(NEEDED_LIB libgraphics64.a
libgdi32.a libimm32.a libmsimg32.a libole32.a
liboleaut32.a libwinmm.a libuuid.a libgdiplus.a
)

include_directories(${PROJECT_INC_DIR}
# ${PROJECT_INC_DIR}/ege
)
link_directories(${PROJECT_SOURCE_DIR}/lib)

#aux_source_directory(./src SOURCE)
#

## 生成dll
#add_library(${PROJECT_NAME} SHARED ${SOURCE} ${PROJECT_INC_DIR})
#install(TARGETS ${PROJECT_NAME} RUNTIME DESTINATION ${PROJECT_SOURCE_DIR}/lib)
#SET_TARGET_PROPERTIES(${PROJECT_NAME} PROPERTIES LINKER_LANGUAGE C)
aux_source_directory(./src SOURCE)
aux_source_directory(./include INCLUDE)

# 生成dll
set(CMAKE_EXE_LINKER_FLAGS "${CMAKE_EXE_LINKER_FLAGS} -Wl,--stack,10000000")



add_library(${PROJECT_NAME} STATIC ${SOURCE} ${INCLUDE})
install(TARGETS ${PROJECT_NAME} DESTINATION ${PROJECT_SOURCE_DIR}/lib)
SET_TARGET_PROPERTIES(${PROJECT_NAME} PROPERTIES LINKER_LANGUAGE C
Expand All @@ -46,7 +43,33 @@ target_link_libraries(demo-test
${PROJECT_SOURCE_DIR}/lib
${NEEDED_LIB}
)




add_executable(draw-array-test example/draw-array-test.cpp)
target_link_libraries(draw-array-test
${PROJECT_NAME}
${PROJECT_SOURCE_DIR}/lib
${NEEDED_LIB}
)
add_executable(dfs-test example/dfs-test.cpp)
target_link_libraries(dfs-test
${PROJECT_NAME}
${PROJECT_SOURCE_DIR}/lib
${NEEDED_LIB}
)
add_executable(bfs-test example/bfs-test.cpp)
target_link_libraries(bfs-test
${PROJECT_NAME}
${PROJECT_SOURCE_DIR}/lib
${NEEDED_LIB}
)
add_executable(gui-test example/gui-test.cpp)
target_link_libraries(gui-test
${PROJECT_NAME}
${PROJECT_SOURCE_DIR}/lib
${NEEDED_LIB}
)
add_executable(visualization-of-bfs-and-dfs example/visualization-of-bfs-and-dfs.cpp)
target_link_libraries(visualization-of-bfs-and-dfs
${PROJECT_NAME}
${PROJECT_SOURCE_DIR}/lib
${NEEDED_LIB}
)
12 changes: 11 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@
项目使用EGE图形库
### 工程结构
`bin`:存放编译生成的exe文件
> 由于git是不支持exe和dll文件的,所以bin目录下的exe文件就存放在`bin.zip`中

`example`:存放演示代码

Expand All @@ -14,6 +15,15 @@
`src`:存放源文件

### 基本思路
使用`Graph`类存放图的基本信息:邻接矩阵、结点信息
使用`GraphNode`类存放结点的信息

实现BFS、DFS可视化思路基本为:

### 实例代码: `example/dfs.cpp`
1. 将所有结点`visibility`设置为false,即全不可见

2. 进行BFS\DFS,将获得的结果依次放入一个数组中,并且将再次将所有结点设为不可见

3. 定义指针指向数组中元素,从而依次画出0下标到index下标中的元素,模拟BFS\DFS操作,通过控制index数值即可实现单步双向操作

### 实例代码: `example/visualization-of-bfs-and-dfs.cpp`
Binary file added bin/bin.zip
Binary file not shown.
5 changes: 5 additions & 0 deletions cmake-build-debug/CMakeFiles/Makefile.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -52,5 +52,10 @@ set(CMAKE_MAKEFILE_PRODUCTS
# Dependency information for all targets:
set(CMAKE_DEPEND_INFO_FILES
"CMakeFiles/datastruct-exp.dir/DependInfo.cmake"
"CMakeFiles/visualization-of-bfs-and-dfs.dir/DependInfo.cmake"
"CMakeFiles/bfs-test.dir/DependInfo.cmake"
"CMakeFiles/demo-test.dir/DependInfo.cmake"
"CMakeFiles/draw-array-test.dir/DependInfo.cmake"
"CMakeFiles/dfs-test.dir/DependInfo.cmake"
"CMakeFiles/gui-test.dir/DependInfo.cmake"
)
153 changes: 149 additions & 4 deletions cmake-build-debug/CMakeFiles/Makefile2
Original file line number Diff line number Diff line change
Expand Up @@ -72,7 +72,12 @@ CMAKE_BINARY_DIR = G:\Desktop\datastruct-exp\cmake-build-debug

# The main recursive "all" target.
all: CMakeFiles/datastruct-exp.dir/all
all: CMakeFiles/visualization-of-bfs-and-dfs.dir/all
all: CMakeFiles/bfs-test.dir/all
all: CMakeFiles/demo-test.dir/all
all: CMakeFiles/draw-array-test.dir/all
all: CMakeFiles/dfs-test.dir/all
all: CMakeFiles/gui-test.dir/all

.PHONY : all

Expand All @@ -83,7 +88,12 @@ preinstall:

# The main recursive "clean" target.
clean: CMakeFiles/datastruct-exp.dir/clean
clean: CMakeFiles/visualization-of-bfs-and-dfs.dir/clean
clean: CMakeFiles/bfs-test.dir/clean
clean: CMakeFiles/demo-test.dir/clean
clean: CMakeFiles/draw-array-test.dir/clean
clean: CMakeFiles/dfs-test.dir/clean
clean: CMakeFiles/gui-test.dir/clean

.PHONY : clean

Expand All @@ -94,12 +104,12 @@ clean: CMakeFiles/demo-test.dir/clean
CMakeFiles/datastruct-exp.dir/all:
$(MAKE) $(MAKESILENT) -f CMakeFiles\datastruct-exp.dir\build.make CMakeFiles/datastruct-exp.dir/depend
$(MAKE) $(MAKESILENT) -f CMakeFiles\datastruct-exp.dir\build.make CMakeFiles/datastruct-exp.dir/build
@$(CMAKE_COMMAND) -E cmake_echo_color --switch=$(COLOR) --progress-dir=G:\Desktop\datastruct-exp\cmake-build-debug\CMakeFiles --progress-num=1,2,3,4 "Built target datastruct-exp"
@$(CMAKE_COMMAND) -E cmake_echo_color --switch=$(COLOR) --progress-dir=G:\Desktop\datastruct-exp\cmake-build-debug\CMakeFiles --progress-num=3,4,5,6,7 "Built target datastruct-exp"
.PHONY : CMakeFiles/datastruct-exp.dir/all

# Build rule for subdir invocation for target.
CMakeFiles/datastruct-exp.dir/rule: cmake_check_build_system
$(CMAKE_COMMAND) -E cmake_progress_start G:\Desktop\datastruct-exp\cmake-build-debug\CMakeFiles 4
$(CMAKE_COMMAND) -E cmake_progress_start G:\Desktop\datastruct-exp\cmake-build-debug\CMakeFiles 5
$(MAKE) $(MAKESILENT) -f CMakeFiles\Makefile2 CMakeFiles/datastruct-exp.dir/all
$(CMAKE_COMMAND) -E cmake_progress_start G:\Desktop\datastruct-exp\cmake-build-debug\CMakeFiles 0
.PHONY : CMakeFiles/datastruct-exp.dir/rule
Expand All @@ -114,19 +124,73 @@ CMakeFiles/datastruct-exp.dir/clean:
$(MAKE) $(MAKESILENT) -f CMakeFiles\datastruct-exp.dir\build.make CMakeFiles/datastruct-exp.dir/clean
.PHONY : CMakeFiles/datastruct-exp.dir/clean

#=============================================================================
# Target rules for target CMakeFiles/visualization-of-bfs-and-dfs.dir

# All Build rule for target.
CMakeFiles/visualization-of-bfs-and-dfs.dir/all: CMakeFiles/datastruct-exp.dir/all
$(MAKE) $(MAKESILENT) -f CMakeFiles\visualization-of-bfs-and-dfs.dir\build.make CMakeFiles/visualization-of-bfs-and-dfs.dir/depend
$(MAKE) $(MAKESILENT) -f CMakeFiles\visualization-of-bfs-and-dfs.dir\build.make CMakeFiles/visualization-of-bfs-and-dfs.dir/build
@$(CMAKE_COMMAND) -E cmake_echo_color --switch=$(COLOR) --progress-dir=G:\Desktop\datastruct-exp\cmake-build-debug\CMakeFiles --progress-num=16,17 "Built target visualization-of-bfs-and-dfs"
.PHONY : CMakeFiles/visualization-of-bfs-and-dfs.dir/all

# Build rule for subdir invocation for target.
CMakeFiles/visualization-of-bfs-and-dfs.dir/rule: cmake_check_build_system
$(CMAKE_COMMAND) -E cmake_progress_start G:\Desktop\datastruct-exp\cmake-build-debug\CMakeFiles 7
$(MAKE) $(MAKESILENT) -f CMakeFiles\Makefile2 CMakeFiles/visualization-of-bfs-and-dfs.dir/all
$(CMAKE_COMMAND) -E cmake_progress_start G:\Desktop\datastruct-exp\cmake-build-debug\CMakeFiles 0
.PHONY : CMakeFiles/visualization-of-bfs-and-dfs.dir/rule

# Convenience name for target.
visualization-of-bfs-and-dfs: CMakeFiles/visualization-of-bfs-and-dfs.dir/rule

.PHONY : visualization-of-bfs-and-dfs

# clean rule for target.
CMakeFiles/visualization-of-bfs-and-dfs.dir/clean:
$(MAKE) $(MAKESILENT) -f CMakeFiles\visualization-of-bfs-and-dfs.dir\build.make CMakeFiles/visualization-of-bfs-and-dfs.dir/clean
.PHONY : CMakeFiles/visualization-of-bfs-and-dfs.dir/clean

#=============================================================================
# Target rules for target CMakeFiles/bfs-test.dir

# All Build rule for target.
CMakeFiles/bfs-test.dir/all: CMakeFiles/datastruct-exp.dir/all
$(MAKE) $(MAKESILENT) -f CMakeFiles\bfs-test.dir\build.make CMakeFiles/bfs-test.dir/depend
$(MAKE) $(MAKESILENT) -f CMakeFiles\bfs-test.dir\build.make CMakeFiles/bfs-test.dir/build
@$(CMAKE_COMMAND) -E cmake_echo_color --switch=$(COLOR) --progress-dir=G:\Desktop\datastruct-exp\cmake-build-debug\CMakeFiles --progress-num=1,2 "Built target bfs-test"
.PHONY : CMakeFiles/bfs-test.dir/all

# Build rule for subdir invocation for target.
CMakeFiles/bfs-test.dir/rule: cmake_check_build_system
$(CMAKE_COMMAND) -E cmake_progress_start G:\Desktop\datastruct-exp\cmake-build-debug\CMakeFiles 7
$(MAKE) $(MAKESILENT) -f CMakeFiles\Makefile2 CMakeFiles/bfs-test.dir/all
$(CMAKE_COMMAND) -E cmake_progress_start G:\Desktop\datastruct-exp\cmake-build-debug\CMakeFiles 0
.PHONY : CMakeFiles/bfs-test.dir/rule

# Convenience name for target.
bfs-test: CMakeFiles/bfs-test.dir/rule

.PHONY : bfs-test

# clean rule for target.
CMakeFiles/bfs-test.dir/clean:
$(MAKE) $(MAKESILENT) -f CMakeFiles\bfs-test.dir\build.make CMakeFiles/bfs-test.dir/clean
.PHONY : CMakeFiles/bfs-test.dir/clean

#=============================================================================
# Target rules for target CMakeFiles/demo-test.dir

# All Build rule for target.
CMakeFiles/demo-test.dir/all: CMakeFiles/datastruct-exp.dir/all
$(MAKE) $(MAKESILENT) -f CMakeFiles\demo-test.dir\build.make CMakeFiles/demo-test.dir/depend
$(MAKE) $(MAKESILENT) -f CMakeFiles\demo-test.dir\build.make CMakeFiles/demo-test.dir/build
@$(CMAKE_COMMAND) -E cmake_echo_color --switch=$(COLOR) --progress-dir=G:\Desktop\datastruct-exp\cmake-build-debug\CMakeFiles --progress-num=5,6 "Built target demo-test"
@$(CMAKE_COMMAND) -E cmake_echo_color --switch=$(COLOR) --progress-dir=G:\Desktop\datastruct-exp\cmake-build-debug\CMakeFiles --progress-num=8,9 "Built target demo-test"
.PHONY : CMakeFiles/demo-test.dir/all

# Build rule for subdir invocation for target.
CMakeFiles/demo-test.dir/rule: cmake_check_build_system
$(CMAKE_COMMAND) -E cmake_progress_start G:\Desktop\datastruct-exp\cmake-build-debug\CMakeFiles 6
$(CMAKE_COMMAND) -E cmake_progress_start G:\Desktop\datastruct-exp\cmake-build-debug\CMakeFiles 7
$(MAKE) $(MAKESILENT) -f CMakeFiles\Makefile2 CMakeFiles/demo-test.dir/all
$(CMAKE_COMMAND) -E cmake_progress_start G:\Desktop\datastruct-exp\cmake-build-debug\CMakeFiles 0
.PHONY : CMakeFiles/demo-test.dir/rule
Expand All @@ -141,6 +205,87 @@ CMakeFiles/demo-test.dir/clean:
$(MAKE) $(MAKESILENT) -f CMakeFiles\demo-test.dir\build.make CMakeFiles/demo-test.dir/clean
.PHONY : CMakeFiles/demo-test.dir/clean

#=============================================================================
# Target rules for target CMakeFiles/draw-array-test.dir

# All Build rule for target.
CMakeFiles/draw-array-test.dir/all: CMakeFiles/datastruct-exp.dir/all
$(MAKE) $(MAKESILENT) -f CMakeFiles\draw-array-test.dir\build.make CMakeFiles/draw-array-test.dir/depend
$(MAKE) $(MAKESILENT) -f CMakeFiles\draw-array-test.dir\build.make CMakeFiles/draw-array-test.dir/build
@$(CMAKE_COMMAND) -E cmake_echo_color --switch=$(COLOR) --progress-dir=G:\Desktop\datastruct-exp\cmake-build-debug\CMakeFiles --progress-num=12,13 "Built target draw-array-test"
.PHONY : CMakeFiles/draw-array-test.dir/all

# Build rule for subdir invocation for target.
CMakeFiles/draw-array-test.dir/rule: cmake_check_build_system
$(CMAKE_COMMAND) -E cmake_progress_start G:\Desktop\datastruct-exp\cmake-build-debug\CMakeFiles 7
$(MAKE) $(MAKESILENT) -f CMakeFiles\Makefile2 CMakeFiles/draw-array-test.dir/all
$(CMAKE_COMMAND) -E cmake_progress_start G:\Desktop\datastruct-exp\cmake-build-debug\CMakeFiles 0
.PHONY : CMakeFiles/draw-array-test.dir/rule

# Convenience name for target.
draw-array-test: CMakeFiles/draw-array-test.dir/rule

.PHONY : draw-array-test

# clean rule for target.
CMakeFiles/draw-array-test.dir/clean:
$(MAKE) $(MAKESILENT) -f CMakeFiles\draw-array-test.dir\build.make CMakeFiles/draw-array-test.dir/clean
.PHONY : CMakeFiles/draw-array-test.dir/clean

#=============================================================================
# Target rules for target CMakeFiles/dfs-test.dir

# All Build rule for target.
CMakeFiles/dfs-test.dir/all: CMakeFiles/datastruct-exp.dir/all
$(MAKE) $(MAKESILENT) -f CMakeFiles\dfs-test.dir\build.make CMakeFiles/dfs-test.dir/depend
$(MAKE) $(MAKESILENT) -f CMakeFiles\dfs-test.dir\build.make CMakeFiles/dfs-test.dir/build
@$(CMAKE_COMMAND) -E cmake_echo_color --switch=$(COLOR) --progress-dir=G:\Desktop\datastruct-exp\cmake-build-debug\CMakeFiles --progress-num=10,11 "Built target dfs-test"
.PHONY : CMakeFiles/dfs-test.dir/all

# Build rule for subdir invocation for target.
CMakeFiles/dfs-test.dir/rule: cmake_check_build_system
$(CMAKE_COMMAND) -E cmake_progress_start G:\Desktop\datastruct-exp\cmake-build-debug\CMakeFiles 7
$(MAKE) $(MAKESILENT) -f CMakeFiles\Makefile2 CMakeFiles/dfs-test.dir/all
$(CMAKE_COMMAND) -E cmake_progress_start G:\Desktop\datastruct-exp\cmake-build-debug\CMakeFiles 0
.PHONY : CMakeFiles/dfs-test.dir/rule

# Convenience name for target.
dfs-test: CMakeFiles/dfs-test.dir/rule

.PHONY : dfs-test

# clean rule for target.
CMakeFiles/dfs-test.dir/clean:
$(MAKE) $(MAKESILENT) -f CMakeFiles\dfs-test.dir\build.make CMakeFiles/dfs-test.dir/clean
.PHONY : CMakeFiles/dfs-test.dir/clean

#=============================================================================
# Target rules for target CMakeFiles/gui-test.dir

# All Build rule for target.
CMakeFiles/gui-test.dir/all: CMakeFiles/datastruct-exp.dir/all
$(MAKE) $(MAKESILENT) -f CMakeFiles\gui-test.dir\build.make CMakeFiles/gui-test.dir/depend
$(MAKE) $(MAKESILENT) -f CMakeFiles\gui-test.dir\build.make CMakeFiles/gui-test.dir/build
@$(CMAKE_COMMAND) -E cmake_echo_color --switch=$(COLOR) --progress-dir=G:\Desktop\datastruct-exp\cmake-build-debug\CMakeFiles --progress-num=14,15 "Built target gui-test"
.PHONY : CMakeFiles/gui-test.dir/all

# Build rule for subdir invocation for target.
CMakeFiles/gui-test.dir/rule: cmake_check_build_system
$(CMAKE_COMMAND) -E cmake_progress_start G:\Desktop\datastruct-exp\cmake-build-debug\CMakeFiles 7
$(MAKE) $(MAKESILENT) -f CMakeFiles\Makefile2 CMakeFiles/gui-test.dir/all
$(CMAKE_COMMAND) -E cmake_progress_start G:\Desktop\datastruct-exp\cmake-build-debug\CMakeFiles 0
.PHONY : CMakeFiles/gui-test.dir/rule

# Convenience name for target.
gui-test: CMakeFiles/gui-test.dir/rule

.PHONY : gui-test

# clean rule for target.
CMakeFiles/gui-test.dir/clean:
$(MAKE) $(MAKESILENT) -f CMakeFiles\gui-test.dir\build.make CMakeFiles/gui-test.dir/clean
.PHONY : CMakeFiles/gui-test.dir/clean

#=============================================================================
# Special targets to cleanup operation of make.

Expand Down
11 changes: 8 additions & 3 deletions cmake-build-debug/CMakeFiles/TargetDirectories.txt
Original file line number Diff line number Diff line change
@@ -1,8 +1,13 @@
G:/Desktop/datastruct-exp/cmake-build-debug/CMakeFiles/list_install_components.dir
G:/Desktop/datastruct-exp/cmake-build-debug/CMakeFiles/datastruct-exp.dir
G:/Desktop/datastruct-exp/cmake-build-debug/CMakeFiles/install/strip.dir
G:/Desktop/datastruct-exp/cmake-build-debug/CMakeFiles/visualization-of-bfs-and-dfs.dir
G:/Desktop/datastruct-exp/cmake-build-debug/CMakeFiles/bfs-test.dir
G:/Desktop/datastruct-exp/cmake-build-debug/CMakeFiles/demo-test.dir
G:/Desktop/datastruct-exp/cmake-build-debug/CMakeFiles/install/local.dir
G:/Desktop/datastruct-exp/cmake-build-debug/CMakeFiles/install.dir
G:/Desktop/datastruct-exp/cmake-build-debug/CMakeFiles/draw-array-test.dir
G:/Desktop/datastruct-exp/cmake-build-debug/CMakeFiles/dfs-test.dir
G:/Desktop/datastruct-exp/cmake-build-debug/CMakeFiles/gui-test.dir
G:/Desktop/datastruct-exp/cmake-build-debug/CMakeFiles/edit_cache.dir
G:/Desktop/datastruct-exp/cmake-build-debug/CMakeFiles/rebuild_cache.dir
G:/Desktop/datastruct-exp/cmake-build-debug/CMakeFiles/list_install_components.dir
G:/Desktop/datastruct-exp/cmake-build-debug/CMakeFiles/install/local.dir
G:/Desktop/datastruct-exp/cmake-build-debug/CMakeFiles/install.dir
Loading